Skip to content

Commit

Permalink
fix issue with doc in staticmethods
Browse files Browse the repository at this point in the history
  • Loading branch information
giannisdoukas committed Jul 20, 2020
1 parent 358d008 commit c6849fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
8 changes: 5 additions & 3 deletions cwlkernel/cwlrepository/CWLComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ def steps(self):
for step in self._steps:
steps[step] = deepcopy(self._steps[step])
if not isinstance(steps[step]['run'], str):
steps[step]['run'] = f"{steps[step]['run']._id}.cwl"
steps[step]['run'] = steps[step]['run'][1]
return deepcopy(steps)

def add(self, component: WorkflowComponent, step_name: str) -> None:
def add(self, component: WorkflowComponent, step_name: str, run_reference: Optional[str] = None) -> None:
if run_reference is None:
run_reference = f'{component.id}.cwl'
self._steps[step_name] = {
'run': component,
'run': (component, run_reference),
'in': {},
'out': []
}
Expand Down
3 changes: 3 additions & 0 deletions cwlkernel/cwlrepository/cwlrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def get_by_id(self, tool_id: str) -> Optional[WorkflowComponent]:
comp = self._registry.get(tool_id, None)
return comp[0] if comp is not None else None

def get_entry_by_id(self, tool_id: str):
return self._registry.get(tool_id, None)

def __iter__(self) -> Iterator[WorkflowComponent]:
for tool in self._registry.values():
yield tool[0]
Expand Down
10 changes: 5 additions & 5 deletions cwlkernel/kernel_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,14 @@ def compile_executed_steps_as_workflow(kernel: CWLKernel, args: str):
workflow_composer = CWLWorkflow(new_workflow_id)

tools_data_tuples = [
(kernel.workflow_repository.get_instance().get_by_id(command.split()[2]), data)
(kernel.workflow_repository.get_instance().get_entry_by_id(command.split()[2]), data)
for command, data in executions_history
]

outputs: Dict[str, List[Dict]] = {out[0].id: out[0].outputs for out in tools_data_tuples}

for tool, data in tools_data_tuples: # type: WorkflowComponent, OrderedDict
workflow_composer.add(tool, tool.id)
outputs: Dict[str, List[Dict]] = {out[0][0].id: out[0][0].outputs for out in tools_data_tuples}
repository_root_dir = kernel.workflow_repository.get_instance()._file_repository.ROOT_DIRECTORY
for (tool, tools_full_path), data in tools_data_tuples: # type: WorkflowComponent, OrderedDict
workflow_composer.add(tool, tool.id, os.path.relpath(tools_full_path, repository_root_dir))
for key_id in data:
if isinstance(data[key_id], dict) and \
'class' in data[key_id] and \
Expand Down
7 changes: 7 additions & 0 deletions examples/githubImport2.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example on importing a workflow from github"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down

0 comments on commit c6849fa

Please sign in to comment.