Skip to content

Commit

Permalink
v0.16.26 (#137)
Browse files Browse the repository at this point in the history
Enabled deep copy of objects with a given prefix when cloning a workspace (closes #131).

For workflow submissions, enabled running non-data model configs by making entity name optional in the CLI, and not including entity name and type in the API payload when they have not been set.

Specifics:
api.py
* added copyFilesWithPrefix parameter to clone_workspace
* create_submission no longer includes entity name and type in its payload when they are not set

fiss.py
* added copyFilesWithPrefix parameter to space_clone
* config_start no longer requires entity to be set

Co-authored-by: M. Morgan Taylor <[email protected]>
  • Loading branch information
dheiman and mmorgantaylor authored Mar 2, 2020
1 parent 3870bee commit 46742e1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ 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 - 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
engine (e.g. rc, script, stdout, stderr), report file sizes, allow
Expand Down
2 changes: 1 addition & 1 deletion firecloud/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Package version
__version__ = "0.16.25"
__version__ = "0.16.26"
16 changes: 12 additions & 4 deletions firecloud/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -1246,7 +1250,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
Expand All @@ -1258,6 +1262,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
Expand All @@ -1277,6 +1282,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)
Expand Down
16 changes: 12 additions & 4 deletions firecloud/fiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -2100,6 +2104,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
Expand Down Expand Up @@ -2495,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'"
Expand Down

0 comments on commit 46742e1

Please sign in to comment.