From e4c732235b637d42f2ee7970597da6c539e40884 Mon Sep 17 00:00:00 2001 From: Morgan Taylor Date: Thu, 27 Feb 2020 11:48:10 -0500 Subject: [PATCH 1/3] allow create_submission without entity information --- firecloud/api.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/firecloud/api.py b/firecloud/api.py index 9dea4bd..e060084 100755 --- a/firecloud/api.py +++ b/firecloud/api.py @@ -1034,7 +1034,7 @@ def list_submissions(namespace, workspace): return __get(uri) def create_submission(wnamespace, workspace, cnamespace, config, - entity, etype, expression=None, use_callcache=True): + entity=None, etype=None, expression=None, use_callcache=True): """Submit job in FireCloud workspace. Args: @@ -1058,11 +1058,15 @@ def create_submission(wnamespace, workspace, cnamespace, config, body = { "methodConfigurationNamespace" : cnamespace, "methodConfigurationName" : config, - "entityType" : etype, - "entityName" : entity, "useCallCache" : use_callcache } + if etype: + body['entityType'] = etype + + if entity: + body['entityName'] = entity + if expression: body['expression'] = expression From 573e0a3eeb4e45d1a355587eba9da41d87ed7f43 Mon Sep 17 00:00:00 2001 From: David Heiman Date: Mon, 2 Mar 2020 10:43:11 -0500 Subject: [PATCH 2/3] Fix for issue #131 added copyFilesWithPrefix parameter to space_clone and clone_workspace. --- changelog.txt | 3 +++ firecloud/__about__.py | 2 +- firecloud/api.py | 6 +++++- firecloud/fiss.py | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7ca3086..44d4173 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,9 @@ Change Log for FISSFC: the (Fi)recloud (S)ervice (S)elector ======================================================================= Terms used below: HL = high level interface, LL = low level interface +v0.16.26 - HL & LL: added copyFilesWithPrefix parameter to space_clone and + clone_workspace. + v0.16.25 - HL: multiple enhancements to mop; only delete unreferenced files generated by workflows, ignore more files generated by the execution engine (e.g. rc, script, stdout, stderr), report file sizes, allow diff --git a/firecloud/__about__.py b/firecloud/__about__.py index 3e0150e..549abea 100644 --- a/firecloud/__about__.py +++ b/firecloud/__about__.py @@ -1,2 +1,2 @@ # Package version -__version__ = "0.16.25" +__version__ = "0.16.26" diff --git a/firecloud/api.py b/firecloud/api.py index 9dea4bd..f66b932 100755 --- a/firecloud/api.py +++ b/firecloud/api.py @@ -1246,7 +1246,7 @@ def update_workspace_acl(namespace, workspace, acl_updates, invite_users_not_fou return __SESSION.patch(uri, headers=headers, data=json.dumps(acl_updates)) def clone_workspace(from_namespace, from_workspace, to_namespace, to_workspace, - authorizationDomain=""): + authorizationDomain="", copyFilesWithPrefix=None): """Clone a FireCloud workspace. A clone is a shallow copy of a FireCloud workspace, enabling @@ -1258,6 +1258,7 @@ def clone_workspace(from_namespace, from_workspace, to_namespace, to_workspace, to_namespace (str): project to which target workspace belongs to_workspace (str): Target workspace's name authorizationDomain: (str) required authorization domains + copyFilesWithPrefix: (str) prefix of bucket objects to copy to the destination workspace Swagger: https://api.firecloud.org/#!/Workspaces/cloneWorkspace @@ -1277,6 +1278,9 @@ def clone_workspace(from_namespace, from_workspace, to_namespace, to_workspace, "attributes": dict(), "authorizationDomain": authDomain, } + + if copyFilesWithPrefix is not None: + body["copyFilesWithPrefix"] = copyFilesWithPrefix uri = "workspaces/{0}/{1}/clone".format(from_namespace, from_workspace) return __post(uri, json=body) diff --git a/firecloud/fiss.py b/firecloud/fiss.py index fbce666..50156a9 100644 --- a/firecloud/fiss.py +++ b/firecloud/fiss.py @@ -147,7 +147,7 @@ def space_clone(args): return 1 r = fapi.clone_workspace(args.project, args.workspace, args.to_project, - args.to_workspace) + args.to_workspace, args.copyFilesWithPrefix) fapi._check_response_code(r, 201) if fcconfig.verbosity: @@ -2100,6 +2100,8 @@ def main(argv=None): 'be different from the workspace being cloned' subp = subparsers.add_parser('space_clone', description=clone_desc, parents=[workspace_parent, dest_space_parent]) + subp.add_argument('-f', '--copyFilesWithPrefix', help='Specify a prefix ' + + 'of bucket objects to copy to the destination workspace') subp.set_defaults(func=space_clone) # Import data into a workspace From 27c97a6c8274516571b54100a1bc3a63586f60f1 Mon Sep 17 00:00:00 2001 From: David Heiman Date: Mon, 2 Mar 2020 14:51:00 -0500 Subject: [PATCH 3/3] Enabled running configs without a data model in the CLI --- changelog.txt | 7 +++++-- firecloud/fiss.py | 12 +++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 44d4173..577c1df 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,8 +3,11 @@ Change Log for FISSFC: the (Fi)recloud (S)ervice (S)elector ======================================================================= Terms used below: HL = high level interface, LL = low level interface -v0.16.26 - HL & LL: added copyFilesWithPrefix parameter to space_clone and - clone_workspace. +v0.16.26 - LL: added copyFilesWithPrefix parameter to clone_workspace, + create_submission no longer includes entity name and type in its + payload when they are not set; HL: added copyFilesWithPrefix + parameter to space_clone, config_start no longer requires entity to + be set in order to enable running non-data model configs. v0.16.25 - HL: multiple enhancements to mop; only delete unreferenced files generated by workflows, ignore more files generated by the execution diff --git a/firecloud/fiss.py b/firecloud/fiss.py index 50156a9..f78a74f 100644 --- a/firecloud/fiss.py +++ b/firecloud/fiss.py @@ -567,6 +567,10 @@ def config_start(args): args.namespace = fcconfig.method_ns if not args.namespace: raise RuntimeError("namespace not provided, or configured by default") + + # If no entity name is given, unset entity_type + if args.entity is None: + args.entity_type = None r = fapi.create_submission(args.project, args.workspace,args.namespace, args.config, args.entity, args.entity_type, @@ -2497,12 +2501,14 @@ def main(argv=None): # Invoke a method configuration subp = subparsers.add_parser('config_start', description='Start running workflow in a given space', - parents=[workspace_parent, conf_parent, entity_parent]) + parents=[workspace_parent, conf_parent]) + subp.add_argument('-e', '--entity', help="Entity name (required if " + + "executing on an entity)") # Duplicate entity type here since we want sample_set to be default subp.add_argument('-t', '--entity-type', default='sample_set', choices=etype_choices, - help='Entity type to assign null values, if attribute ' + - 'is missing. Default: %(default)s') + help='Entity type of specified entity. Not used if no ' + + 'entity is named. Default: %(default)s') expr_help = "(optional) Entity expression to use when entity type " \ "doesn't match the method configuration." \ "Example: 'this.samples'"