# Cwltool.main text arguments a hard requirement for provenance?

**URL:** <https://cwl.discourse.group/t/cwltool-main-text-arguments-a-hard-requirement-for-provenance/862>\
**Category:** CWL Questions\
**Created:** [January 5, 2024, 11:10am UTC](https://cwl.discourse.group/t/cwltool-main-text-arguments-a-hard-requirement-for-provenance/862 "2024-01-05T11:10:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidjsherman](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/davidjsherman/32/205_2.png) [@davidjsherman](https://cwl.discourse.group/u/davidjsherman)\
**Post date:** [January 5, 2024, 11:10am UTC](https://cwl.discourse.group/t/cwltool-main-text-arguments-a-hard-requirement-for-provenance/862/1 "2024-01-05T11:10:33Z")

</div>

It seems that the _text_ of the command-line arguments is always required when requesting provenance, even when providing preparsed arguments, and even though `setup_provenance` will happily skip them if absent. Why is this a hard requirement?

One can invoke `cwltoo.main` with optional parameters `args` for preprocessed arguments and `argsl` for command-line arguments to be parsed. Both of these are `Optional`, and if empty, are assigned from `sys.argv`. However, [`cwltool.main` insists](https://github.com/common-workflow-language/cwltool/blob/8ff1fd05a12a124d104a67b7fd8ac3382c3e5212/cwltool/main.py#L1051-L1055) that `argsl` not be empty.

Concretely, this means that if we invoke `cwltool` only with preparsed arguments, we must also provide an unparsed list of text arguments if we want to request provenance.

Note that the only use of this list is in [`cwltool.setup_provenance`](https://github.com/common-workflow-language/cwltool/blob/8ff1fd05a12a124d104a67b7fd8ac3382c3e5212/cwltool/main.py#L704-L707) where **if nonempty** it is logged in the provenance, and ignored otherwise. Regardless, the parsed arguments are then logged in the provenance.

---

<div class="post-metadata">

**Author:** ![davidjsherman](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/davidjsherman/32/205_2.png) [@davidjsherman](https://cwl.discourse.group/u/davidjsherman)\
**Post date:** [January 5, 2024, 4:13pm UTC](https://cwl.discourse.group/t/cwltool-main-text-arguments-a-hard-requirement-for-provenance/862/2 "2024-01-05T16:13:36Z")

</div>

In case providing text arguments isn’t really a requirement, I went ahead and opened issue [cwltool#1963](https://github.com/common-workflow-language/cwltool/issues/1963), with a very simple test case.

As I mentioned there, the current behavior of `cwltool` prevents requesting provenance in [Calrissian](https://github.com/Duke-GCB/calrissian) (CWL on Kubernetes).

---

<div class="post-metadata">

**Author:** ![davidjsherman](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/davidjsherman/32/205_2.png) [@davidjsherman](https://cwl.discourse.group/u/davidjsherman)\
**Post date:** [January 13, 2024, 7:52am UTC](https://cwl.discourse.group/t/cwltool-main-text-arguments-a-hard-requirement-for-provenance/862/3 "2024-01-13T07:52:54Z")

</div>

The conclusion was that providing the text of the arguments isn’t a requirement for provenance. Issue [cwltool#1963](https://github.com/common-workflow-language/cwltool/issues/1963) was resolved by pull request [cwltool#1964](https://github.com/common-workflow-language/cwltool/pull/1964) (merged, thank you @mrc).

We can now obtain a provenance RO-Crate when running CWL with Calrissian, albeit using a patched version for now until the next `cwltool` release
