# Renku Workflow

Renku uses PROV-O and its own Renku ontology to represent workflows.

## Run

Represents a workflow template.

class `renku.core.models.workflow.run.``OrderedSubprocess`(*, id, index, process)

  A subprocess with ordering.

  Method generated by attrs for class OrderedSubprocess.

  static `generate_id`(parent_id, index)

    Generate an id for an `OrderedSubprocess`.

class `renku.core.models.workflow.run.``OrderedSubprocessSchema`(*args, commit=None, client=None, **kwargs)

  OrderedSubprocess schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.run.OrderedSubprocess`

class `renku.core.models.workflow.run.``Run`(*, commit=None, client=None, path=None, id=None, label=NOTHING, project=None, command=None, successcodes=NOTHING, subprocesses=NOTHING, arguments=NOTHING, inputs=NOTHING, outputs=NOTHING, run_parameters=NOTHING, name=None, description=None, keywords=NOTHING, activity=None)

  Represents a renku run execution template.

  Method generated by attrs for class Run.

  property `activity`

    Return the activity object.

  `add_subprocess`(subprocess)

    Adds a subprocess to this run.

  `as_jsonld`()

    Create JSON-LD.

  classmethod `from_factory`(factory, client, commit, path, name, description, keywords)

    Creates a `Run` from a `CommandLineToolFactory`.

  classmethod `from_jsonld`(data)

    Create an instance from JSON-LD data.

  static `generate_id`(client, identifier=None)

    Generate an id for an argument.

  `to_argv`()

    Convert run into argv list.

  `to_stream_repr`()

    Input/output stream representation.

  `update_id_and_label_from_commit_path`(client, commit, path, is_subprocess=False)

    Updates the _id and _label using supplied commit and path.

class `renku.core.models.workflow.run.``RunSchema`(*args, commit=None, client=None, **kwargs)

  Run schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.run.Run`

## Parameters

Represents a workflow template.

class `renku.core.models.workflow.parameters.``CommandArgument`(*, id=None, label=None, default_value=None, description=None, name=None, position=None, prefix=None, value=None)

  An argument to a command that is neither input nor output.

  Method generated by attrs for class CommandArgument.

  `as_jsonld`()

    Create JSON-LD.

  `default_label`()

    Set default label.

  `default_name`()

    Create a default name.

  classmethod `from_jsonld`(data)

    Create an instance from JSON-LD data.

  static `generate_id`(run_id, position=None)

    Generate an id for an argument.

  `to_argv`()

    String representation (sames as cmd argument).

class `renku.core.models.workflow.parameters.``CommandArgumentSchema`(*args, commit=None, client=None, **kwargs)

  CommandArgument schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.parameters.CommandArgument`

class `renku.core.models.workflow.parameters.``CommandInput`(*, id=None, label=None, default_value=None, description=None, name=None, position=None, prefix=None, consumes, mapped_to=None)

  An input to a command.

  Method generated by attrs for class CommandInput.

  `as_jsonld`()

    Create JSON-LD.

  `default_label`()

    Set default label.

  `default_name`()

    Create a default name.

  classmethod `from_jsonld`(data)

    Create an instance from JSON-LD data.

  static `generate_id`(run_id, position=None)

    Generate an id for an argument.

  `to_argv`()

    String representation (sames as cmd argument).

  `to_stream_repr`()

    Input stream representation.

class `renku.core.models.workflow.parameters.``CommandInputSchema`(*args, commit=None, client=None, **kwargs)

  CommandArgument schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.parameters.CommandInput`

class `renku.core.models.workflow.parameters.``CommandOutput`(*, id=None, label=None, default_value=None, description=None, name=None, position=None, prefix=None, create_folder=False, produces, mapped_to=None)

  An output of a command.

  Method generated by attrs for class CommandOutput.

  `as_jsonld`()

    Create JSON-LD.

  `default_label`()

    Set default label.

  `default_name`()

    Create a default name.

  classmethod `from_jsonld`(data)

    Create an instance from JSON-LD data.

  static `generate_id`(run_id, position=None)

    Generate an id for an argument.

  `to_argv`()

    String representation (sames as cmd argument).

  `to_stream_repr`()

    Input stream representation.

class `renku.core.models.workflow.parameters.``CommandOutputSchema`(*args, commit=None, client=None, **kwargs)

  CommandArgument schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.parameters.CommandOutput`

class `renku.core.models.workflow.parameters.``CommandParameter`(*, id=None, label=None, default_value=None, description=None, name=None, position=None, prefix=None)

  Represents a parameter for an execution template.

  Method generated by attrs for class CommandParameter.

  `default_label`()

    Set default label.

  `default_name`()

    Create a default name.

  property `sanitized_id`

    Return `_id` sanitized for use in non-jsonld contexts.

class `renku.core.models.workflow.parameters.``CommandParameterSchema`(*args, commit=None, client=None, **kwargs)

  CommandParameter schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.parameters.CommandParameter`

class `renku.core.models.workflow.parameters.``MappedIOStream`(*, client=None, id=None, label=None, stream_type)

  Represents an IO stream (stdin, stdout, stderr).

  Method generated by attrs for class MappedIOStream.

  `as_jsonld`()

    Create JSON-LD.

  `default_id`()

    Generate an id for a mapped stream.

  `default_label`()

    Set default label.

  classmethod `from_jsonld`(data)

    Create an instance from JSON-LD data.

class `renku.core.models.workflow.parameters.``MappedIOStreamSchema`(*args, commit=None, client=None, **kwargs)

  MappedIOStream schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.parameters.MappedIOStream`

class `renku.core.models.workflow.parameters.``RunParameter`(*, id=None, label=None, name=None, value=None, type=None)

  A run parameter that is set inside the script.

  Method generated by attrs for class RunParameter.

  `as_jsonld`()

    Create JSON-LD.

  `default_label`()

    Set default label.

  classmethod `from_jsonld`(data)

    Create an instance from JSON-LD data.

  static `generate_id`(run_id, name)

    Generate an id.

class `renku.core.models.workflow.parameters.``RunParameterSchema`(*args, commit=None, client=None, **kwargs)

  RunParameter schema.

  Create an instance.

  class `Meta`

    Meta class.

    `model`

      alias of `renku.core.models.workflow.parameters.RunParameter`

# Renku Workflow Conversion

Renku allows conversion of tracked workflows to runnable workflows in supported tools (Currently CWL)

## CWL

Converter for workflows to cwl.

class `renku.core.models.workflow.converters.cwl.``CWLConverter`

  Converts a `Run` to cwl file(s).

  static `convert`(run, basedir, path=None)

    Convert the workflow to one ore more .cwl files.