Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions ephemeris/workflow_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .common_parser import get_common_args


def import_workflow(gi, path):
def import_workflow(gi, path, publish_wf=False):
"""
Given a connection to a Galaxy Instance (gi) and a path to a Galaxy workflow file,
this function will import the worklfow into Galaxy.
Expand All @@ -17,7 +17,7 @@ def import_workflow(gi, path):
import_uuid = json.load(wf_file).get('uuid')
existing_uuids = [d.get('latest_workflow_uuid') for d in gi.workflows.get_workflows()]
if import_uuid not in existing_uuids:
gi.workflows.import_workflow_from_local_path(path)
gi.workflows.import_workflow_from_local_path(path, publish=publish_wf)


def _parser():
Expand All @@ -26,6 +26,10 @@ def _parser():
parser.add_argument("-w", "--workflow_path",
required=True,
help='Path to a workflow file or a directory with multiple workflow files ending with ".ga"')
parser.add_argument("--publish_workflows",
required=False,
action='store_true',
help='Flag to publish all imported workflows, so that they are viewable by other users')
return parser


Expand All @@ -39,9 +43,9 @@ def main():
if os.path.isdir(args.workflow_path):
for file_path in os.listdir(args.workflow_path):
if file_path.endswith('.ga'):
import_workflow(gi, os.path.join(args.workflow_path, file_path))
import_workflow(gi, os.path.join(args.workflow_path, file_path), args.publish_workflows)
else:
import_workflow(gi, args.workflow_path)
import_workflow(gi, args.workflow_path, args.publish_workflows)


if __name__ == '__main__':
Expand Down