示例#1
0
文件: jobs_tests.py 项目: jlbrewe/hub
def test_dispatch_parallel():
    Account.objects.create(name="stencila")

    parent = Job.objects.create(method="parallel")
    parent.children.set([
        Job.objects.create(method="sleep"),
        Job.objects.create(method="sleep"),
        Job.objects.create(method="sleep"),
    ])

    dispatch_job(parent)

    assert parent.status is None
    for child in parent.children.all():
        assert child.status == JobStatus.DISPATCHED.value
示例#2
0
文件: jobs_tests.py 项目: jlbrewe/hub
def test_dispatch_series():
    Account.objects.create(name="stencila")

    parent = Job.objects.create(method="series")
    parent.children.set([
        Job.objects.create(method="sleep"),
        Job.objects.create(method="sleep"),
        Job.objects.create(method="sleep"),
    ])

    dispatch_job(parent)

    assert parent.status is None
    children = parent.children.all()
    assert children[0].status == JobStatus.DISPATCHED.value
    assert children[1].status is None
    assert children[2].status is None
示例#3
0
    def dispatch(self) -> "Job":
        from jobs.jobs import dispatch_job

        return dispatch_job(self)