예제 #1
0
def battle(args):
    from checkio_client.actions.check import get_filename
    filename = get_filename(args)
    mission = args.mission[0]

    if args.recompile:
        recompile_mission(mission)
    logging.info('Using: ' + filename)

    ref_extra_volume = None
    if args.balance:
        logging.info('Balance from:' + args.balance)
        if not os.path.exists(args.balance):
            logging.info('Balance "' + args.balance +
                         '" does not exists. Using was skiped')
        else:
            ref_extra_volume = {
                args.balance: {
                    'bind': '/opt/balance',
                    'mode': 'ro'
                }
            }

    execute_referee('battle',
                    mission,
                    filename,
                    ref_extra_volume=ref_extra_volume)
예제 #2
0
def init_mission(args):
    from checkio_client.actions.repo import link_folder_to_repo, clone_repo_to_folder
    domain_data = conf.default_domain_data
    mission = args.mission[0]
    folder = Folder(mission)

    if folder.exists():
        print('Folder exists already')
        return

    if args.template:
        template = args.template
    else:
        domain_data = conf.default_domain_data
        template = domain_data['repo_template']

    clone_repo_to_folder(template, folder.mission_folder())

    if args.repository:
        print('Send to git...')
        link_folder_to_repo(folder.mission_folder(), args.repository)

    recompile_mission(mission)
    if not args.without_container:
        rebuild_mission(mission)
    init_home_file(mission)

    print('Done')
예제 #3
0
def main_check_eoc_local(args):
    from checkio_client.eoc.testing import execute_referee
    filename = get_filename(args)
    mission = args.mission[0]

    if args.recompile:
        from checkio_client.eoc.getters import recompile_mission
        recompile_mission(mission)
    logging.info('Using: ' + filename)
    execute_referee('check', mission, filename, ref_extra_volume=eoc_get_extra_volume(args))
예제 #4
0
def battle(args):
    from checkio_client.actions.check import get_filename
    filename = get_filename(args)
    mission = args.mission

    force_build = args.force_build

    if not force_build:
        force_build = not can_check_mission(mission)

    if force_build:
        mission_git_getter(args.repo, args.mission)
        recompile_mission(args.mission)
        rebuild_mission(args.mission)

    if args.recompile:
        recompile_mission(mission)
    logging.info('Using: ' + filename)

    ref_extra_volume = None
    if args.balance:
        logging.info('Balance from:' + args.balance)
        if not os.path.exists(args.balance):
            logging.info('Balance "' + args.balance +
                         '" does not exists. Using was skiped')
        else:
            ref_extra_volume = {
                args.balance: {
                    'bind': '/opt/balance',
                    'mode': 'ro'
                }
            }

    battle_json = execute_referee('battle',
                                  mission,
                                  filename,
                                  ref_extra_volume=ref_extra_volume)

    if args.output_file:
        with open(args.output_file, 'w') as fh:
            fh.write(battle_json)
    else:
        send_battle_to_server(battle_json)
예제 #5
0
def complile_mission(args):
    recompile_mission(args.mission)
예제 #6
0
def get_git(args):
    mission_git_getter(args.url, args.mission)
    recompile_mission(args.mission)
    if not args.without_container:
        rebuild_mission(args.mission)
    init_home_file(args.mission)