Clean up all the jobs associated with this link.

        Returns a `JobStatus` enum
779834
def clean_jobs(self, link, job_dict=None, clean_all=False):
        
        failed = False
        if job_dict is None:
            job_dict = link.jobs

        for job_details in job_dict.values():
            # clean failed jobs
            if job_details.status == JobStatus.failed or clean_all:
                # clean_job(job_details.logfile, job_details.outfiles, self._dry_run)
                clean_job(job_details.logfile, {}, self._dry_run)
                job_details.status = JobStatus.ready
        if failed:
            return JobStatus.failed
        return JobStatus.done
686087
@Override
    public void cleanQueueJob(){
        try {
            Set<Long> ids = queueCleanerService.getFinishedExecStateIds();
            if(logger.isDebugEnabled()) logger.debug("Will clean from queue the next Exec state ids amount:"+ids.size());

            Set<Long> execIds = new HashSet<>();

            for (Long id : ids) {
                execIds.add(id);
                if (execIds.size() >= QUEUE_BULK_SIZE) {
                    queueCleanerService.cleanFinishedSteps(execIds);
                    execIds.clear();
                }
            }

            if (execIds.size() > 0) {
                queueCleanerService.cleanFinishedSteps(execIds);
            }
        } catch (Exception e) {
            logger.error("Can't run queue cleaner job.", e);
        }
    }
544196
public function clean() {
		if (!Configure::read('Queue.cleanuptimeout')) {
			$this->abort('You disabled cleanuptimout in config. Aborting.');
		}

		$this->out('Deleting old jobs, that have finished before ' . date('Y-m-d H:i:s', time() - (int)Configure::read('Queue.cleanuptimeout')));
		$this->QueuedJobs->cleanOldJobs();
		$this->QueueProcesses->cleanEndedProcesses();
	}
1215003
def clean(self):

        

        self.closing = True # schedule for closing.

        if not self.fds:
            self.data.close()
1246986
def clear_candidates(self, clear_env=True):
        
        async def slave_task(addr):
            r_manager = await self.env.connect(addr)
            return await r_manager.clear_candidates()

        self._candidates = []
        if clear_env:
            if self._single_env:
                self.env.clear_candidates()
            else:
                mgrs = self.get_managers()
                run(create_tasks(slave_task, mgrs))
31714
def jobs(opts={})

      opts = { opts => true } if opts.is_a?(Symbol)

      jobs = @jobs.to_a

      if opts[:running]
        jobs = jobs.select { |j| j.running? }
      elsif ! opts[:all]
        jobs = jobs.reject { |j| j.next_time.nil? || j.unscheduled_at }
      end

      tags = Array(opts[:tag] || opts[:tags]).collect(&:to_s)
      jobs = jobs.reject { |j| tags.find { |t| ! j.tags.include?(t) } }

      jobs
    end
31854
def all_notebook_jobs(self):
        
        from db.models.notebooks import NotebookJob

        return NotebookJob.all.filter(project=self)
1077371
def _cleaned(_dashboard):
    ''''''
    dashboard = copy.deepcopy(_dashboard)

    for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS:
        dashboard.pop(ignored_dashboard_field, None)
    for row in dashboard.get('rows', []):
        for ignored_row_field in _IGNORED_ROW_FIELDS:
            row.pop(ignored_row_field, None)
        for i, panel in enumerate(row.get('panels', [])):
            for ignored_panel_field in _IGNORED_PANEL_FIELDS:
                panel.pop(ignored_panel_field, None)
            for target in panel.get('targets', []):
                for ignored_target_field in _IGNORED_TARGET_FIELDS:
                    target.pop(ignored_target_field, None)
            row['panels'][i] = _stripped(panel)

    return dashboard
423919
public function clear()
    {
        foreach ($this->jobs as $name => $job) {
            $key = $this->makeCacheKey($name);
            $this->cache->forget($key);
        }

        $this->jobs = array();
    }
1081691
def _check_link_completion(self, link, fail_pending=False, fail_running=False):
        

        status_vect = JobStatusVector()
        for job_key, job_details in link.jobs.items():
            # if job_details.status == JobStatus.failed:
            #    failed = True
            #    continue
            # elif job_details.status == JobStatus.done:
            #    continue
            if job_key.find(JobDetails.topkey) >= 0:
                continue
            job_details.status = self._interface.check_job(job_details)
            if job_details.status == JobStatus.pending:
                if fail_pending:
                    job_details.status = JobStatus.failed
            elif job_details.status == JobStatus.running:
                if fail_running:
                    job_details.status = JobStatus.failed
            status_vect[job_details.status] += 1
            link.jobs[job_key] = job_details
            link._set_status_self(job_details.jobkey, job_details.status)

        return status_vect
267312
def all_jobs(self):
        
        return list(set(self.complete + self.failed + self.queue + self.running))
1035279
def clear_jobs():
    '''
    '''
    if not is_authorized():
        return json.dumps({'error': 'not authorized'}), 403, headers

    days = flask.request.args.get('days', None)
    return _clear_jobs(days)
748647
def clean(self):
        
        # Note that we do not close the connection here -- somebody
        # may still be reading from it.
        while len(self.queue) > 0 and self._pair_stale(self.queue[0]):
            self.queue.pop(0)
964580
def clean_indexes(self):
        
        self.sort()
        for index, item in enumerate(self):
            item.index = index + 1
658369
def clear_jobs(self, recursive=True):
        
        if recursive:
            for link in self._links.values():
                link.clear_jobs(recursive)
        self.jobs.clear()
1329111
def _clean(self):
        """"""
        if self._workers:
            for w in self._workers:
                if w.is_finished():
                    self._workers.remove(w)
        else:
            self._current_worker = None
            self._timer.stop()
89649
def submit_jobs(self, link, job_dict=None, job_archive=None, stream=sys.stdout):
        
        failed = False
        if job_dict is None:
            job_dict = link.jobs

        for job_key, job_details in sorted(job_dict.items()):
            job_config = job_details.job_config
            # clean failed jobs
            if job_details.status == JobStatus.failed:
                clean_job(job_details.logfile,
                          job_details.outfiles, self._dry_run)
                # clean_job(job_details.logfile, {}, self._dry_run)
            job_config['logfile'] = job_details.logfile
            new_job_details = self.dispatch_job(
                link, job_key, job_archive, stream)
            if new_job_details.status == JobStatus.failed:
                failed = True
                clean_job(new_job_details.logfile,
                          new_job_details.outfiles, self._dry_run)
            link.jobs[job_key] = new_job_details
        if failed:
            return JobStatus.failed
        return JobStatus.done