In [1]:
import urllib
import ovation.lab.workflows as workflows
from ovation.session import connect
from tqdm import tqdm_notebook as tqdm
from pprint import pprint
In [ ]:
s = connect(input('Email: '), api='https://services-staging.ovation.io', token='/api/v1/sessions')
Workflow activities are (optionally) uniquely labeled by the Workflow Definition. This label allows clients to upload metadata and files to activities by label. In this example, we create a new XX activity within an existing workflow.
In [ ]:
# TODO source, destination
metadata = {'custom_attributes': {'my-attribute': 1}}
resources = {'resource-label': '/Users/barry/Desktop/Ovation Demo Files/results.txt'}
In [ ]:
workflow_id = input('Workflow ID: ')
In [ ]:
activity_label = input('Activity label: ')
For illustration, we view the Workflow, showing links.activity_label.related
, the URL where create_activity
will POST the new Activity data
In [ ]:
workflow = s.get(s.path('workflows', workflow_id))
pprint(workflow.workflow)
Now, let's create the activity.
In [ ]:
activity = workflows.create_activity(s, workflow_id, activity_label, data=metadata, resources=resources, progress=tqdm)