common-workflow-language / common-workflow-language/cwltool

Workflow Factory should use argparse

Open
#1,031 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

## Expected Behavior
When `factory.py` is used, it shows the same behavior as when executed with command line.

## Actual Behavior
- There is an option that I can not use like Issue #778 "Workflow factory does not resolve path to location "
- RuntimeContext when executing job is different

In `factory.py`, runtimeContext and loadingContext are generated with the following parts, and they are executed as they are.

factory.py 50-53
```python
if loading_context is None:
self.loading_context = LoadingContext()
if runtime_context is None:
self.runtime_context = RuntimeContext()
```

On the other hand, when executing on the command line, the main function of `main.py` is used.

As shown below, loadingContext and runtimeContext are declared and workflow is excuting.

main.py 508, 620, 816-819
```python
runtimeContext = RuntimeContext(vars(args))
loadingContext = LoadingContext(vars(args))

(out, status) = executor(tool,
initialized_job_order_object,
runtimeContext,
logger=_logger)
```

Therefore, I compared runtimeContext and loadingContext respectively immediately after the declaration and immediately before the execution of the workflow.
I inserted the following print statement in `main.py` and then I tried to emurate the command line execution with the following code.

```python
pprint(vars(runtimeContext))
pprint(vars(loadingContext))
```

```python
from cwltool.main import main
WORKFLOW_FILE = "/home/ubuntu/cwl-test/CWL-workflows/Workflows/test-workflow.cwl"
JOB_ORDER_FILE = "/home/ubuntu/cwl-test/CWL-workflows/Jobs/small.ERR034597.test-workflow.yml"

if __name__ == "__main__":
main(
[
WORKFLOW_FILE,
JOB_ORDER_FILE,
],
)
```

The following items of runtimeContext were different immediately after declaration and immediately before execution.

After declaration
```
'basedir': None,
'find_default_container': None,
'secret_store': None,
```

Before execution
```
'basedir': '/home/ubuntu/cwl-test/CWL-workflows/Jobs',
'find_default_container': functools.partial(, use_biocontainers=None, default_container=None),
'secret_store': ,
```

## Workflow Code
Using https://github.com/hacchy1983/CWL-workflows

```
cwltool Workflows/test-workflow.cwl Jobs/small.ERR034597.test-workflow.yml
```

## Your Environment
- Ubuntu: 16.04

```
$ python3 -V
Python 3.5.2
$ cwltool --version
/home/ubuntu/.local/bin/cwltool 1.0.20181217162649
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.