Return a list of job ids
961348
def get_jids():
    '''
    
    '''
    conn, mdb = _get_conn(ret=None)
    map = "function() { emit(this.jid, this); }"
    reduce = "function (key, values) { return values[0]; }"
    result = mdb.jobs.inline_map_reduce(map, reduce)
    ret = {}
    for r in result:
        jid = r['_id']
        ret[jid] = salt.utils.jid.format_jid_instance(jid, r['value'])
    return ret
109336
def get_log(db, job_id):
    
    logs = db('SELECT * FROM log WHERE job_id=?x ORDER BY id', job_id)
    out = []
    for log in logs:
        time = str(log.timestamp)[:-4]  # strip decimals
        out.append('[%s #%d %s] %s' % (time, job_id, log.level, log.message))
    return out
899121
def get_jobs_by_status(status)
      r = []
      @jobs_by_id.values.each do |i|
        r << i if i.status == status.to_sym || status.to_sym == :all
      end
      return r
    end
988473
def get_item_ids(self):
        """"""
        item_ids = []
        if self.has_items():
            for idstr in self._my_map['itemIds']:
                item_ids.append(idstr)
        return IdList(item_ids)
1243358
def cj(job_ids):
        '''''' 
        for job_id in job_ids:
            job_id_types = set(map(type, job_ids))
            assert(len(job_id_types) == 1 and type(1) == job_id_types.pop())
            args = shlex.split('qmod -cj {0}'.format(job_id))
            subprocess.call(args, shell=False)
414879
def jobs(self):
        
        if self._jobs is None:
            self._jobs = JobTable(self.connection, self.database)
        return self._jobs
426717
def get_child_jobs(self):
        
        # Lazily load info
        if self.info is None:
            self.get_info()

        # Lazily load children
        if self.children is not None:
            return self.children
        else:
            if 'children' in self.info:
                child_list = []
                for child in self.info['children']['items']:
                    child_job = GPJob(self.server_data, child['jobId'])
                    child_job.info = child
                    child_job.load_info()
                    child_list.append(child_job)
                return child_list
            else:               # No children? Return empty list
                return []
798598
def list_current_jobs(self):
        
        jobs = {}
        for job in self.scheduler.get_jobs():
            if job.name not in ('schedule_jobs', 'process_status_queue'):
                jobs[job.name] = job

        return jobs
1370941
def list(args):
  """"""
  jm = setup(args)
  jm.list(job_ids=get_ids(args.job_ids), print_array_jobs=args.print_array_jobs, print_dependencies=args.print_dependencies, status=args.status, long=args.long, print_times=args.print_times, ids_only=args.ids_only, names=args.names)
584650
def list_jobs(tail):
    """"""
    query = (
        db.session.query(models.CrawlerJob)
        .order_by(models.CrawlerJob.id.desc())
    )
    if tail != 0:
        query = query.limit(tail)

    results = query.yield_per(10).all()
    _show_table(results=results)
290901
def get_ids(cs):
    """"""
    records = []
    for c in cs:
        records.append({k: c[k] for k in c if k in {'names', 'labels'}})
    return records
47830
def get_job_logs(id):
    """"""
    crawler_job = models.CrawlerJob.query.filter_by(id=id).one_or_none()
    if crawler_job is None:
        click.secho(
            (
                "CrawlJob %s was not found, maybe it's not a crawl job?" %
                id
            ),
            fg='yellow',
        )
        sys.exit(1)

    if crawler_job.logs is None:
        click.secho(
            (
                "CrawlJob %s has no log, it might be that it has not run "
                "yet, you can try again later." %
                id
            ),
            fg='yellow',
        )
        sys.exit(1)

    _show_file(
        file_path=crawler_job.logs,
        header_name='Log',
    )
511183
def get_all_jobstates(user, job_id):
    
    args = schemas.args(flask.request.args.to_dict())
    job = v1_utils.verify_existence_and_get(job_id, models.JOBS)
    if user.is_not_super_admin() and user.is_not_read_only_user():
        if (job['team_id'] not in user.teams_ids and
            job['team_id'] not in user.child_teams_ids):
            raise dci_exc.Unauthorized()

    query = v1_utils.QueryBuilder(_TABLE, args, _JS_COLUMNS)
    query.add_extra_condition(_TABLE.c.job_id == job_id)

    # get the number of rows for the '_meta' section
    nb_rows = query.get_number_of_rows()
    rows = query.execute(fetchall=True)
    rows = v1_utils.format_result(rows, _TABLE.name, args['embed'],
                                  _EMBED_MANY)
    return flask.jsonify({'jobstates': rows, '_meta': {'count': nb_rows}})
61594
def build_joblist(jobgraph):
    """"""
    jobset = set()
    for job in jobgraph:
        jobset = populate_jobset(job, jobset, depth=1)
    return list(jobset)
362383
def grid_reload_from_ids(oargrid_jobids):
    
    gk = get_api_client()
    jobs = []
    for site, job_id in oargrid_jobids:
        jobs.append(gk.sites[site].jobs[job_id])
    return jobs
212350
def get_jobs_from_queue(self, queue: str, max_jobs: int) -> List[Job]:
        """"""
        jobs_json_string = self._run_script(
            self._get_jobs_from_queue,
            self._to_namespaced(queue),
            self._to_namespaced(RUNNING_JOBS_KEY.format(self._id)),
            JobStatus.RUNNING.value,
            max_jobs
        )

        jobs = json.loads(jobs_json_string.decode())
        jobs = [Job.deserialize(job) for job in jobs]

        return jobs
905043
def get_logs(self, jobs, log_file=None):
        """"""
        if not (jobs and self.log_url):
            return

        for job in jobs:
            url = "{}?jobId={}".format(self.log_url, job.get("id"))
            if log_file:
                self._download_log("{}&download".format(url), log_file)
            else:
                logger.info("Submit log for job %s: %s", job.get("id"), url)