# girder-job-sequence

This is a utility package for running multiple Girder jobs in a sequence.

- Define a group of jobs with inputs:
    - Only pass non-default parameters
    - Use wildcard "{{}}" strings to define inputs that are not present until they are created with a previous plugin
```python

# This is where you define which plugins you'd like to run and in what order
from girder_job_sequence.utils import from_list

plugin_list = [
    {
        'plugin_id': 'uuid_string',
        'input_args': [
            {
                'name': 'parameter_1',
                'value': 5
            },
            {
                'name': 'parameter_2_with_wildcard',
                'value': "{{'type':'file','item_type':'path','item_query':'/collections/path/to/item.svs','file_type':'fileName','file_query':'name_of_file.csv'}}"
            }
        ]
    },
    {
        'docker_image': 'user/name:tag',
        'cli': 'PluginName',
        'input_args': [
            {
                'name': 'input_param',
                'value': 'blahblahblah'
            }
        ]
    }
]

job_sequence = from_list(job_list)

job_sequence.start(cancel_on_error=True,verbose=True)


```
- Check default parameters with:

```python
# Code example showing how to get default plugin parameters
from girder_job_sequence import Job
import json

job_object = Job(plugin_id = 'uuid_string')

print(json.dumps(job_object.inputs,indent=4))

```

- Check status of group of jobs

```python

from girder_job_sequence.utils import from_list

plugin_list = [
    {
        'plugin_id': 'uuid_string',
        'input_args': [
            {
                'name': 'parameter_1',
                'value': 5
            },
            {
                'name': 'parameter_2_with_wildcard',
                'value': "{{'type':'file','item_type':'path','item_query':'/collections/path/to/item.svs','file_type':'fileName','file_query':'name_of_file.csv'}}"
            }
        ]
    },
    {
        'docker_image': 'user/name:tag',
        'cli': 'PluginName',
        'input_args': [
            {
                'name': 'input_param',
                'value': 'blahblahblah'
            }
        ]
    }
]

job_sequence = from_list(job_list)

job_sequence.start(cancel_on_error=True,verbose=False)

print(job_sequence.get_status())

```

- (#TODO): Set email notification for job step or group




