Ejemplo n.º 1
0
def start_preset_solution():
    parser = get_args_parser(
        'Create and start solution of verification job created on the base of specified preset.'
    )
    parser.add_argument(
        'preset',
        type=UUID,
        help=
        'Preset job identifier (uuid). Can be obtained form presets/jobs/base.json'
    )
    parser.add_argument('--replacement',
                        help='JSON file name or string with data what files '
                        'should be replaced before starting solution.')
    parser.add_argument('--rundata',
                        help='JSON file name. Set it if you would like to '
                        'start solution with specific settings.')
    args = parser.parse_args()

    cli = Cli(args.host, args.username, args.password)
    _, job_uuid = cli.create_job(args.preset)
    _, decision_uuid = cli.start_job_decision(job_uuid,
                                              rundata=args.rundata,
                                              replacement=args.replacement)

    print('Solution of verification job "{0}" was successfully started: {1}'.
          format(job_uuid, decision_uuid))
Ejemplo n.º 2
0
def solve_job(preset_job_id, instance_ip):
    print(f'Solve {preset_job_id} job')

    cli = Cli(host=f'{instance_ip}:8998',
              username='******',
              password='******')
    decision_conf = os.path.join(os.path.dirname(__file__), 'decision.conf')

    job_id = cli.create_job(preset_job_id)[1]
    decision_id = cli.start_job_decision(job_id, rundata=decision_conf)[1]

    while True:
        time.sleep(5)
        progress = cli.decision_progress(decision_id)

        if int(progress['status']) > 2:
            break

    assert progress['status'] == '3'