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

Allow Stdout / stderr to better participate in operations #58

Open
illusional opened this issue Jan 26, 2021 · 0 comments
Open

Allow Stdout / stderr to better participate in operations #58

illusional opened this issue Jan 26, 2021 · 0 comments

Comments

@illusional
Copy link
Member

illusional commented Jan 26, 2021

Stdout / Stderr are currently types in Janis, but in reality they're probably better as selectors with type File. Being a Selector means they will better participate in operations (like .contents()) or maybe a suggested new .read_json() -> then an index operator could be used.

This would be useful when converting CWL in the cases of ExpressionTool or a commandlinetool that declares the stdout: cwl.output.json (without an outputBinding pattern).

  • WDL -> stdout()
  • CWL -> File should have path _stdout which you could collect with glob, or manually construct using path / basname

Maybe even making it an operator. You end up the CWL expression of self[0] to represent the glob order from here:

glob, value_from = (
[STDOUT_NAME, STDERR_NAME]
if requires_std
else translate_to_cwl_glob(
output.selector, inputsdict, outputtag=output.tag, tool=tool, **debugkwargs
)
)

class Stdout(Operator):
    @staticmethod
    def friendly_signature():
        return "() -> File"

    def argtypes(self) -> List[DataType]:
        return []

    def evaluate(self, inputs):
        return ""

    def to_wdl(self, unwrap_operator, *args):
        return "stdout()"

    def to_cwl(self, unwrap_operator, *args):
        return 'self[0]'

    def __init__(self, return_type=File):
        super().__init__()
        self.return_type = get_instantiated_type(return_type)

    def returntype(self):
        return self.return_type

    def to_string_formatter(self):
        kwargs = {"stdout": self}
        from janis_core.operators.stringformatter import StringFormatter

        return StringFormatter("{stdout}", **kwargs)
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

No branches or pull requests

1 participant