To use:
- Derive your class from GbdxTaskInterface.
- Implement invoke() function.
- Use context management to run your task:
with MyTask() as task:
task.invoke()
Refer to the example.py for usage
When developping or debugging it can be helpful to "run" the task locally. You can locally create a folder that will mimic the input structure that the task will see when it is run. You can then set this task interface to use this local folder.
Create the derived GbdxTaskInterface with the local folder location
MyTask(work_path="/local/folder/location")
Then when you locally run the task it will read from and write to this directory. Note: you will need to remove this work_path from the task when the task is run on the workflow system.
To run the above local folder you need to setup the data like the workflow system does which includes the following
For details see: https://gbdxdocs.digitalglobe.com/docs/task-and-workflow-course
/
└── local/folder/location
├── gbdx_runtime.json (use to mimic getting tokens from user impersonation)
├── input
| ├── ports.json (if you use string ports)
| └── input_directory_port (one directory per input dir port)
| ├── file1.txt
| ├── file2.txt
| └── file3.txt
└── output (create this folder but leave empty)
Run time information like the passed token used by user impersonation.
Contents should look something like this:
{
"user_token":"FAKE_TOKEN"
}
Place your input sting ports in this file inside the input directory
{
"input_string_port_name": "really useful data!"
}
Create folders named after the input directory ports and fill them with your input data files
You should see your output folder populated and a status.json file created. If you output any string ports there should be a ports.json file created in the output folder. For each output directory port there should be a folder created with the generated files.
/
└── local/folder/location
├── gbdx_runtime.json (use to mimic getting tokens from user impersonation)
├── input
| ├── ports.json (if you use string ports)
| └── input_directory_port (one directory per input dir port)
| ├── file1.txt
| ├── file2.txt
| └── file3.txt
└── output
| ├── ports.json (if you output string ports)
| └── output_directory_port (one directory per outputput dir port)
| ├── file1.txt
| ├── file2.txt
| └── file3.txt
└── status.json
This file is creted on task completion and contains the final status and the "note"
{
"status": "success",
"reason": "Task succes status note"
}