AustralianSynchrotron / lightflow

A lightweight, distributed workflow system
https://australiansynchrotron.github.io/lightflow/
BSD 3-Clause "New" or "Revised" License
98 stars 18 forks source link

how to start workflow using API #17

Closed lazywhite closed 6 years ago

lazywhite commented 6 years ago
current
    lightflow workflow start <simple>

Is there a way to start workflow like this?
    import lightflow
    import simple
    lightflow.start_workflow(simple)
portrain commented 6 years ago

Absolutely, the following code starts a workflow 'simple':

from lightflow.config import Config
from lightflow.workflows import start_workflow

config = Config()
config.load_from_file()

job_id = start_workflow(name='simple', config=config)
print('Started workflow with ID', job_id)

You will need to create a Config object either manually or loading from a config file (shown above) and then call the start_workflow function. Does this help?