Remove a link between two processes
4471
def unlink_intermediate(self, sourceId, targetId):
        
        
        source = self.database['items'][(self.database.get('name'), sourceId)]
        target = self.database['items'][(self.database.get('name'), targetId)]

        production_exchange = [x['input'] for x in source['exchanges'] if x['type'] == 'production'][0]

        new_exchanges = [x for x in target['exchanges'] if x['input'] != production_exchange]

        target['exchanges'] = new_exchanges

        self.parameter_scan()

        return True
1134717
def unlink(self, key, *keys):
        """"""
        return wait_convert(self.execute(b'UNLINK', key, *keys), int)
1698
def cleanup(self):
        

        while self.inactive_timeout > 0:
            self.time = time.time()

            keys = []

            for key, client in self.clients.items.items():
                t = getattr(client, "active_at", 0)
                if t > 0 and self.time - t > self.inactive_timeout:
                    client.kwargs["link"].disconnect()
                    keys.append(key)

            for key in keys:
                self.log_debug("Removing client (inactive): %s" % key)
                del self.clients[key]

            time.sleep(1)
1221204
def clean_process_tree(*signal_handler_args):
    """"""
    parent = psutil.Process()
    procs = parent.children(recursive=True)
    if procs:
        print(f"[ZProc] Cleaning up {parent.name()!r} ({os.getpid()})...")

    for p in procs:
        with suppress(psutil.NoSuchProcess):
            p.terminate()
    _, alive = psutil.wait_procs(procs, timeout=0.5)  # 0.5 seems to work
    for p in alive:
        with suppress(psutil.NoSuchProcess):
            p.kill()

    try:
        signum = signal_handler_args[0]
    except IndexError:
        pass
    else:
        os._exit(signum)
1030307
private void cleanupProcess(LinuxProcess linuxProcess, int stdinFd, int stdoutFd, int stderrFd)
   {
      pidToProcessMap.remove(linuxProcess.getPid());
      fildesToProcessMap.remove(stdinFd);
      fildesToProcessMap.remove(stdoutFd);
      fildesToProcessMap.remove(stderrFd);

      //        linuxProcess.close(linuxProcess.getStdin());
      //        linuxProcess.close(linuxProcess.getStdout());
      //        linuxProcess.close(linuxProcess.getStderr());

      if (linuxProcess.cleanlyExitedBeforeProcess.get()) {
         linuxProcess.onExit(0);
         return;
      }

      IntByReference ret = new IntByReference();
      int rc = LibC.waitpid(linuxProcess.getPid(), ret, LibC.WNOHANG);

      if (rc == 0) {
         deadPool.add(linuxProcess);
      }
      else if (rc < 0) {
         linuxProcess.onExit((Native.getLastError() == LibC.ECHILD) ? Integer.MAX_VALUE : Integer.MIN_VALUE);
      }
      else {
         handleExit(linuxProcess, ret.getValue());
      }
   }
801648
def unlink(self, definition, doc1, doc2) :
        ""
        links = self.database[definition].fetchByExample( {"_from": doc1._id,"_to" : doc2._id}, batchSize = 100)
        for l in links :
            self.deleteEdge(l)
476728
def _cleanup_processing_chain(self):
        """"""
        self.log("Removing stale processing chain entries.")
        self._processing_chain = [x for x in self._processing_chain
                                  if x.remember_between_connections]
1307238
def _fallback_cleanups(self):
        '''
        
        '''
        # Add an extra fallback in case a forked process leaks through
        multiprocessing.active_children()

        # Cleanup Windows threads
        if not salt.utils.platform.is_windows():
            return
        for thread in self.win_proc:
            if not thread.is_alive():
                thread.join()
                try:
                    self.win_proc.remove(thread)
                    del thread
                except (ValueError, NameError):
                    pass
960645
def worker_wrapper(worker_instance, pid_path):
    
    def exit_handler(*args):
        """
        Remove pid file on exit
        """
        if len(args) > 0:
            print("Exit py signal {signal}".format(signal=args[0]))
        remove(pid_path)

    atexit.register(exit_handler)
    signal.signal(signal.SIGINT, exit_handler)
    signal.signal(signal.SIGTERM, exit_handler)

    worker_instance.work()

    # Remove pid file if the process can not catch signals
    exit_handler(2)
478182
def cleanup_mprocess(config_path, cfg):
    
    for key in ('keyFile', 'logPath', 'dbpath'):
        remove_path(cfg.get(key, None))
    isinstance(config_path, str) and os.path.exists(config_path) and remove_path(config_path)
172124
def _closure_deletelink(self, oldparentpk):
        """"""
        self._closure_model.objects.filter(
            **{
                "parent__%s__child" % self._closure_parentref(): oldparentpk,
                "child__%s__parent" % self._closure_childref(): self.pk
            }
        ).delete()
986810
def _clear_process(self):
        
        if self.process:
            if self.process.stdin:
                self.process.stdin.close()
            if self.process.stdout:
                self.process.stdout.close()

            self.process = None

        self._endtime = None
273402
def cleanup_temporary_directories(self):
        """"""
        while self.build_directories:
            shutil.rmtree(self.build_directories.pop())
        for requirement in self.reported_requirements:
            requirement.remove_temporary_source()
        while self.eggs_links:
            symbolic_link = self.eggs_links.pop()
            if os.path.islink(symbolic_link):
                os.unlink(symbolic_link)
19094
def unlink(self):
        
        if self._closed:
            self._raise_closed()
        self._accessor.unlink(self)
445185
function unlink(mode, target, system, containerDef, container, out, cb) {
    logger.info('unlinking');
    out.stdout('unlinking');

    var elb = findParentELB(system, container);

    if (elb) {
      logger.info(elb, 'elb found');
      unlinkFromELB(mode, system, elb, container, out, cb);
    } else {
      logger.info('elb not found');
      cb(null, target);
    }
  }
160263
def unlink(self, parameter):
        

        if not isinstance(parameter,list):
        # Make a list of one element
            parameter_list  = [parameter]
        else:
        # Make a copy to avoid tampering with the input
            parameter_list = list(parameter)
            
        for param in parameter_list:    
            if param.has_auxiliary_variable():
                param.remove_auxiliary_variable()

            else:

                with warnings.catch_warnings():

                    warnings.simplefilter("always", RuntimeWarning)

                    warnings.warn("Parameter %s has no link to be removed." % param.path, RuntimeWarning)
1250025
def _remove_broken_links():
    '''
    
    '''
    enabled_dir = MICRODROP_CONDA_PLUGINS.joinpath('enabled')
    if not enabled_dir.isdir():
        return []

    broken_links = []
    for dir_i in enabled_dir.walkdirs(errors='ignore'):
        if platform.system() == 'Windows':
            if dir_i.isjunction() and not dir_i.readlink().isdir():
                # Junction/link target no longer exists.
                broken_links.append(dir_i)
        else:
            raise NotImplementedError('Unsupported platform')

    removed_links = []
    for link_i in broken_links:
        try:
            link_i.unlink()
        except:
            pass
        else:
            removed_links.append(link_i)
    return removed_links