Beispiel #1
0
def test_get_task_bucket(scopes, expected, raises):
    task = {'scopes': scopes}
    config = {'bucket_config': {'dep': ''}, 'taskcluster_scope_prefix': 'project:releng:beetmover:'}
    if raises:
        with pytest.raises(ScriptWorkerTaskException):
            get_task_bucket(task, config)
    else:
        assert expected == get_task_bucket(task, config)
Beispiel #2
0
def test_get_task_bucket(scopes, expected, raises):
    task = {"scopes": scopes}
    config = {
        "bucket_config": {
            "dep": ""
        },
        "taskcluster_scope_prefix": "project:releng:beetmover:"
    }
    if raises:
        with pytest.raises(ScriptWorkerTaskException):
            get_task_bucket(task, config)
    else:
        assert expected == get_task_bucket(task, config)
async def async_main(context):
    for module in ("botocore", "boto3", "chardet"):
        logging.getLogger(module).setLevel(logging.INFO)

    setup_mimetypes()

    validate_task_schema(context)

    connector = aiohttp.TCPConnector(
        limit=context.config["aiohttp_max_connections"])
    async with aiohttp.ClientSession(connector=connector) as session:
        context.session = session

        # determine the task bucket and action
        context.bucket = get_task_bucket(context.task, context.config)
        context.action = get_task_action(context.task,
                                         context.config,
                                         valid_actions=action_map.keys())

        if action_map.get(context.action):
            await action_map[context.action](context)
        else:
            log.critical("Unknown action {}!".format(context.action))
            sys.exit(3)

    log.info("Success!")
Beispiel #4
0
async def async_main(context):
    # determine the task and make a quick validation check against its schema
    context.task = get_task(context.config)  # e.g. $cfg['work_dir']/task.json
    validate_task_schema(context)

    # determine the task bucket and action
    context.bucket = get_task_bucket(context.task, context.config)
    context.action = get_task_action(context.task, context.config)

    if action_map.get(context.action):
        await action_map[context.action](context)
    else:
        log.critical("Unknown action {}!".format(context.action))
        sys.exit(3)

    log.info('Success!')