Git Product home page Git Product logo

Comments (2)

lrodrin avatar lrodrin commented on August 18, 2024

added cases to manage arrays of files and strings in executionInputs:

def executionInputs(self, matInputs: List[MaterializedInput], cwlInputs):
"""
Setting execution inputs needed to execute the workflow
"""
if len(matInputs) == 0: # Is list of materialized inputs empty?
raise WorkflowEngineException("FATAL ERROR: Execution with no inputs")
if len(cwlInputs) == 0: # Is list of declared inputs empty?
raise WorkflowEngineException("FATAL ERROR: Workflow with no declared inputs")
execInputs = dict()
for matInput in matInputs:
if isinstance(matInput, MaterializedInput): # input is a MaterializedInput
# numberOfInputs = len(matInput.values) # number of inputs inside a MaterializedInput
for input_value in matInput.values:
name = matInput.name
value_type = cwlInputs.get(name, {}).get('type')
if value_type is None:
raise WorkflowEngineException("ERROR: input {} not available in workflow".format(name))
value = input_value
if isinstance(value, MaterializedContent): # value of an input contains MaterializedContent
if value.kind in (ContentKind.Directory, ContentKind.File):
if not os.path.exists(value.local):
self.logger.warning("Input {} is not materialized".format(name))
value_local = value.local
if isinstance(value_type, dict):
# MaterializedContent is a List of File and cwlInputs value_type is a dict
classType = value_type['items']
execInputs.setdefault(name, []).append({"class": classType, "location": value_local})
elif isinstance(value_type, list):
# MaterializedContent is a List of File and cwlInputs value_type is a list
classType = value_type[1]['items']
execInputs.setdefault(name, []).append({"class": classType, "location": value_local})
else: # MaterializedContent is a File
classType = value_type
execInputs[name] = {"class": classType, "location": value_local}
else:
raise WorkflowEngineException(
"ERROR: Input {} has values of type {} this code does not know how to handle".format(
name, value.kind))
else:
if isinstance(value_type, list): # argument is a list
if isinstance(value_type[1], dict) and value_type[1]['type'] == "array":
execInputs.setdefault(name, []).append(value)
else:
execInputs[name] = value # TODO add more value types
else:
execInputs[name] = value
return execInputs

from wfexs-backend.

jmfernandez avatar jmfernandez commented on August 18, 2024

Fixed along several commits. The issue arose when some input or output has more than one possible type. These cases are quite common in CWL, so it needed several refinements. Commits d3363a1 , 2062e81 , bc0da5f , 3a75c97 , 0f4c029 led to the proper handling of this use case

from wfexs-backend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.