Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expressions in Janis #10

Closed
wants to merge 141 commits into from
Closed

Expressions in Janis #10

wants to merge 141 commits into from

Conversation

illusional
Copy link
Member

@illusional illusional commented Mar 26, 2020

This PR addresses and closes:

Most workflow specifications allow you to transform some value:

We want to support at least some of this functionality. CWL affords us much more flexibility as we could generate javascript functions, WDL is a little stricter in which we would really only implement the standard library for now.

One generic way might be to create a "JavaScript tool", and then we could share generated javascript expressions between CWL and WDL. This would allow us to very flexibly go outside the standard library functions, but adds complexity and potential costs to perform this computation (depending on how it's executed).

Requirements

  • Transform an input, or a derived
  • Be moderately type-safe

Considerations

As part of this type system, we might reconsider adding a check between the selector and the ToolOutput type (to make sure they're valid).

Guide

Janis now supports an Operator to transform some value from a Selector, or the result from another Operator. You could see an operator as a function, but that might include adding, subtracting, and so on.

Where possible, we've tried to override the inbuilt python functions. You can see how we could prefix the value from the input node w.input_value with "prefix".

w.step("stepId", MyTool(changed_input="prefix" + w.input_value))

Note, this doesn't right now change the value of the input node, it builds up a set of operations (AddOperator("prefix", InputSelector("input_value"))), which then get turned into either javascript or WDL functions.

Applying the representation function of a single operator (operator.__repr__()) will give you pseudocode of the operation you're going to implement.

WIP

This PR is work in progress, there is moderate support for WDL currently, and the type system is lacking.

# Conflicts:
#	janis_core/types/selectors.py
#	janis_core/utils/__init__.py
#	janis_core/workflow/workflow.py
# Conflicts:
#	janis_core/types/selectors.py
@illusional
Copy link
Member Author

@illusional illusional mentioned this pull request May 21, 2020
@illusional
Copy link
Member Author

More thoughts, I've yet to categorise these yet:

# Conflicts:
#	janis_core/tests/test_translation_cwl.py
# Conflicts:
#	janis_core/graph/steptaginput.py
#	janis_core/tests/test_translation_cwl.py
#	janis_core/tests/test_translation_wdl.py
#	janis_core/translations/cwl.py
#	janis_core/translations/wdl.py
#	janis_core/workflow/workflow.py
#	setup.py
# Conflicts:
#	janis_core/tool/commandtool.py
#	janis_core/translations/cwl.py
(implementation for CWL still in testing)
@illusional illusional marked this pull request as ready for review July 13, 2020 05:43
@illusional
Copy link
Member Author

Cromwell PR has been merged 🎉 !!

This PR has been folded into #38, so see that for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

question: add arguments to workflow step inputs cwl/wdl basename methods Expressions in Janis
2 participants