Пример #1
0
def main():
    args = parse_cli()
    cmd_utils.setup_logging(args)
    cmd_utils.load_config(args)
    client = Client(args.server, args.cluster_name)

    error_code = 0
    global _run_interval
    _run_interval = args.run_interval
    url_index = client.index()
    if args.job is None:
        jobs = client.jobs(include_job_runs=True)
        for job in jobs:
            try:
                check_job_result(job=job,
                                 client=client,
                                 url_index=url_index,
                                 dry_run=args.dry_run)
            except Exception as e:
                log.warning(
                    f"check job result fails for job {job.get('name', '')}: {e}"
                )
                error_code = 1
    else:
        job_url = client.get_url(args.job)
        job = client.job_runs(job_url)
        check_job_result(job=job,
                         client=client,
                         url_index=url_index,
                         dry_run=args.dry_run)

    return error_code
Пример #2
0
def main():
    args = parse_cli()
    cmd_utils.setup_logging(args)
    cmd_utils.load_config(args)
    client = Client(args.server)

    error_code = 0
    global _run_interval
    _run_interval = args.run_interval
    if args.job is None:
        jobs = client.jobs(include_job_runs=True)
        for job in jobs:
            try:
                check_job_result(job=job, client=client, dry_run=args.dry_run)
            except Exception as e:
                log.warning(
                    "check job result fails for job {}: {}".format(
                        job.get('name', ''),
                        e,
                    )
                )
                error_code = 1
    else:
        job_url = client.get_url(args.job)
        job = client.job_runs(job_url)
        check_job_result(job=job, client=client, dry_run=args.dry_run)

    return error_code
Пример #3
0
def main():
    args = parse_cli()
    cmd_utils.setup_logging(args)
    cmd_utils.load_config(args)
    client = Client(args.server)

    if args.job is None:
        jobs = client.jobs(include_job_runs=True)
        for job in jobs:
            check_job_result(job=job, client=client, dry_run=args.dry_run)
    else:
        job_url = client.get_url(args.job)
        job = client.job_runs(job_url)
        check_job_result(job=job, client=client, dry_run=args.dry_run)
Пример #4
0
def tron_jobs_completer(prefix, **kwargs):
    if os.path.isfile(TAB_COMPLETE_FILE):
        with opener(TAB_COMPLETE_FILE, 'r') as f:
            jobs = f.readlines()
        return filter_jobs_actions_runs(
            prefix=prefix,
            inputs=[job.strip('\n\r') for job in jobs],
        )
    else:
        if 'client' not in kwargs:
            client = Client(get_default_server())
        else:
            client = kwargs['client']
        return filter_jobs_actions_runs(
            prefix=prefix,
            inputs=[job['name'] for job in client.jobs()],
        )
Пример #5
0
def tron_jobs_completer(prefix, **kwargs):
    if os.path.isfile(TAB_COMPLETE_FILE):
        with opener(TAB_COMPLETE_FILE, 'r') as f:
            jobs = f.readlines()
        return filter_jobs_actions_runs(
            prefix=prefix,
            inputs=[job.strip('\n\r') for job in jobs],
        )
    else:
        if 'client' not in kwargs:
            client = Client(get_default_server())
        else:
            client = kwargs['client']
        return filter_jobs_actions_runs(
            prefix=prefix,
            inputs=[job['name'] for job in client.jobs()],
        )
Пример #6
0
def tron_jobs_completer(prefix, parsed_args, **kwargs):
    default_client = Client(get_default_server())
    return (job['name'] for job in default_client.jobs()
            if job['name'].startswith(prefix))