Beispiel #1
0
def configure_taskdesc_for_run(config, job, taskdesc):
    """
    Run the appropriate function for this job against the given task
    description.

    This will raise an appropriate error if no function exists, or if the job's
    run is not valid according to the schema.
    """
    run_using = job['run']['using']
    if run_using not in registry:
        raise Exception("no functions for run.using {!r}".format(run_using))

    worker_implementation = job['worker']['implementation']
    if worker_implementation not in registry[run_using]:
        raise Exception("no functions for run.using {!r} on {!r}".format(
            run_using, worker_implementation))

    func, schema = registry[run_using][worker_implementation]
    if schema:
        job['run'] = validate_schema(
                schema, job['run'],
                "In job.run using {!r} for job {!r}:".format(
                    job['run']['using'], job['label']))

    func(config, job, taskdesc)
Beispiel #2
0
def validate(config, jobs):
    for job in jobs:
        label = job.get('dependent-task',
                        object).__dict__.get('label', '?no-label?')
        yield validate_schema(
            beetmover_description_schema, job,
            "In beetmover ({!r} kind) task for {!r}:".format(
                config.kind, label))
Beispiel #3
0
def configure_taskdesc_for_run(config, job, taskdesc):
    """
    Run the appropriate function for this job against the given task
    description.

    This will raise an appropriate error if no function exists, or if the job's
    run is not valid according to the schema.
    """
    run_using = job['run']['using']
    if run_using not in registry:
        raise Exception("no functions for run.using {!r}".format(run_using))

    worker_implementation = job['worker']['implementation']
    if worker_implementation not in registry[run_using]:
        raise Exception("no functions for run.using {!r} on {!r}".format(
            run_using, worker_implementation))

    func, schema = registry[run_using][worker_implementation]
    if schema:
        job['run'] = validate_schema(
            schema, job['run'], "In job.run using {!r} for job {!r}:".format(
                job['run']['using'], job['label']))

    func(config, job, taskdesc)
Beispiel #4
0
def validate(config, tests):
    for test in tests:
        yield validate_schema(test_description_schema, test,
                              "In test {!r}:".format(test['test-name']))
Beispiel #5
0
def validate(config, tests):
    for test in tests:
        yield validate_schema(test_description_schema, test,
                              "In test {!r}:".format(test['test-name']))
Beispiel #6
0
def validate_again(config, jobs):
    for job in jobs:
        yield validate_schema(l10n_description_schema, job,
                              "In job {!r}:".format(job.get('name', 'unknown')))
Beispiel #7
0
def validate(config, tasks):
    for task in tasks:
        yield validate_schema(
            task_description_schema, task,
            "In task {!r}:".format(task.get('label', '?no-label?')))
Beispiel #8
0
def validate(config, tasks):
    for task in tasks:
        yield validate_schema(
            task_description_schema, task,
            "In task {!r}:".format(task.get('label', '?no-label?')))
Beispiel #9
0
def validate(config, jobs):
    for job in jobs:
        label = job.get("dependent-task", object).__dict__.get("label", "?no-label?")
        yield validate_schema(
            signing_description_schema, job, "In signing ({!r} kind) task for {!r}:".format(config.kind, label)
        )
 def test_invalid(self):
     try:
         validate_schema(schema, {'x': 'not-int'}, "pfx")
         self.fail("no exception raised")
     except Exception, e:
         self.failUnless(str(e).startswith("pfx\n"))
 def test_valid(self):
     validate_schema(schema, {'x': 10, 'y': 'foo'}, "pfx")
Beispiel #12
0
 def test_invalid(self):
     try:
         validate_schema(schema, {'x': 'not-int'}, "pfx")
         self.fail("no exception raised")
     except Exception, e:
         self.failUnless(str(e).startswith("pfx\n"))
Beispiel #13
0
 def test_valid(self):
     validate_schema(schema, {'x': 10, 'y': 'foo'}, "pfx")
Beispiel #14
0
def validate(config, jobs):
    for job in jobs:
        yield validate_schema(job_description_schema, job,
                              "In job {!r}:".format(job['name']))
Beispiel #15
0
def validate(config, jobs):
    for job in jobs:
        yield validate_schema(job_description_schema, job,
                              "In job {!r}:".format(job['name']))
Beispiel #16
0
def validate_again(config, jobs):
    for job in jobs:
        yield validate_schema(
            l10n_description_schema, job,
            "In job {!r}:".format(job.get('name', 'unknown')))