DigitalGlobe / gbdxtools

(Deprecated) Python SDK for using GBDX
MIT License
74 stars 57 forks source link

Add callbacks for workflow status #86

Closed loominator1970 closed 7 years ago

loominator1970 commented 7 years ago

It would be very useful to include workflow callbacks into the gbdxtools suite. This already exists in the API. Please put it into gbdxtools. I have attached instructions on how to do workflow callbacks in the API (written by Scott Dunbar) callbacks.html.zip

garciapablo commented 7 years ago

This would be useful. The documentation also isn't always clear. They test for a callback key in the output of a workflow: https://github.com/DigitalGlobe/gbdxtools/blob/09076be159de0874d741e9149882c7e33d73c34d/tests/unit/test_workflow.py

But there is no other mention of how to use it or pass it as an argument. I tried passing an argument when instantiation a Workflow object o add tasks:

workflow = gbdx.Workflow(tasks, callback='callback_url')

However that didn't seem to work. But I may be doing something wrong on my end.

nricklin commented 7 years ago

Yep callbacks aren't implemented into gbdxtools yet, so we will do it. The way you specify @garciapablo looks good and is likely what we will implement.

garciapablo commented 7 years ago

Update: this worked for us. We'll update our code once the callback is implemented.

One thing we are testing is getting the payload, adding the callback and then launch the workflow from the new payload. We think it should work.

payload = workflow.generate_workflow_description()
payload['callback'] = callback
workflow_id = gbdx.workflow.launch(payload)
nricklin commented 7 years ago

gbdxtools verison 0.9.3 now supports callbacks like this:

workflow = gbdx.Workflow(tasks, callback='callback_url')