Skip to main content

Directed Acyclic Workflow Graph Scheduling

Project description

Directed Acyclic Workflow Graph Scheduling

import time

from dawgz import job, after, waitfor, ensure, schedule

@job(name='A')
def a():
    print('a')
    time.sleep(3)
    print('a')
    raise Exception()

@job(name='B')
def b():
    time.sleep(1)
    print('b')
    time.sleep(1)
    print('b')

finished = [True] * 100
finished[42] = False

@after(a, b)
@waitfor('any')
@ensure(lambda i: finished[i])
@job(name='C', array=100)
def c(i: int):
    print(f'c{i}')
    finished[i] = True

@after(a, status='any')
@after(b, c, status='success')
@waitfor('all')
@job(name='D')
def d():
    print('d')
    time.sleep(1)
    print('d')

schedule(d, backend=None)  # prints a b b c420 a d d

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dawgz-0.1.2.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

dawgz-0.1.2-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page