repository_name
stringlengths 5
67
| func_path_in_repository
stringlengths 4
234
| func_name
stringlengths 0
314
| whole_func_string
stringlengths 52
3.87M
| language
stringclasses 6
values | func_code_string
stringlengths 52
3.87M
| func_documentation_string
stringlengths 1
47.2k
| func_code_url
stringlengths 85
339
|
---|---|---|---|---|---|---|---|
dnanexus/dx-toolkit | src/python/dxpy/api.py | project_new | def project_new(input_params={}, always_retry=False, **kwargs):
"""
Invokes the /project/new API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject%2Fnew
"""
return DXHTTPRequest('/project/new', input_params, always_retry=always_retry, **kwargs) | python | def project_new(input_params={}, always_retry=False, **kwargs):
"""
Invokes the /project/new API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject%2Fnew
"""
return DXHTTPRequest('/project/new', input_params, always_retry=always_retry, **kwargs) | Invokes the /project/new API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Projects#API-method%3A-%2Fproject%2Fnew | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1076-L1082 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_add_tags | def record_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/addTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
"""
return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/addTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
"""
return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/addTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1084-L1090 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_add_types | def record_add_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/addTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
"""
return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_add_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/addTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
"""
return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/addTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1092-L1098 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_close | def record_close(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/close API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
"""
return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_close(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/close API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
"""
return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/close API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1100-L1106 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_describe | def record_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Records#API-method%3A-%2Frecord-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Records#API-method%3A-%2Frecord-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Records#API-method%3A-%2Frecord-xxxx%2Fdescribe | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1108-L1114 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_get_details | def record_get_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/getDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
"""
return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_get_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/getDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
"""
return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/getDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1116-L1122 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_list_projects | def record_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/listProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects
"""
return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/listProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects
"""
return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/listProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1124-L1130 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_remove_tags | def record_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/removeTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags
"""
return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/removeTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags
"""
return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/removeTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1132-L1138 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_remove_types | def record_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/removeTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
"""
return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/removeTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
"""
return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/removeTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1140-L1146 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_rename | def record_rename(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/rename API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
"""
return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_rename(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/rename API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
"""
return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/rename API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1148-L1154 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_set_details | def record_set_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/setDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
"""
return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_set_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/setDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
"""
return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/setDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1156-L1162 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_set_properties | def record_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/setProperties API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
"""
return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/setProperties API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
"""
return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/setProperties API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1164-L1170 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | record_set_visibility | def record_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/setVisibility API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
"""
return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def record_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /record-xxxx/setVisibility API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
"""
return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /record-xxxx/setVisibility API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1172-L1178 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_describe_data_objects | def system_describe_data_objects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/describeDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeDataObjects
"""
return DXHTTPRequest('/system/describeDataObjects', input_params, always_retry=always_retry, **kwargs) | python | def system_describe_data_objects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/describeDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeDataObjects
"""
return DXHTTPRequest('/system/describeDataObjects', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/describeDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeDataObjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1189-L1195 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_describe_executions | def system_describe_executions(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/describeExecutions API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeExecutions
"""
return DXHTTPRequest('/system/describeExecutions', input_params, always_retry=always_retry, **kwargs) | python | def system_describe_executions(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/describeExecutions API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeExecutions
"""
return DXHTTPRequest('/system/describeExecutions', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/describeExecutions API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeExecutions | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1197-L1203 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_describe_projects | def system_describe_projects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/describeProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeProjects
"""
return DXHTTPRequest('/system/describeProjects', input_params, always_retry=always_retry, **kwargs) | python | def system_describe_projects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/describeProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeProjects
"""
return DXHTTPRequest('/system/describeProjects', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/describeProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeProjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1205-L1211 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_affiliates | def system_find_affiliates(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findAffiliates API method.
"""
return DXHTTPRequest('/system/findAffiliates', input_params, always_retry=always_retry, **kwargs) | python | def system_find_affiliates(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findAffiliates API method.
"""
return DXHTTPRequest('/system/findAffiliates', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findAffiliates API method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1213-L1217 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_apps | def system_find_apps(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findApps API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindApps
"""
return DXHTTPRequest('/system/findApps', input_params, always_retry=always_retry, **kwargs) | python | def system_find_apps(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findApps API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindApps
"""
return DXHTTPRequest('/system/findApps', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findApps API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindApps | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1219-L1225 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_data_objects | def system_find_data_objects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDataObjects
"""
return DXHTTPRequest('/system/findDataObjects', input_params, always_retry=always_retry, **kwargs) | python | def system_find_data_objects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDataObjects
"""
return DXHTTPRequest('/system/findDataObjects', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDataObjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1227-L1233 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_global_workflows | def system_find_global_workflows(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findGlobalWorkflows API method.
"""
return DXHTTPRequest('/system/findGlobalWorkflows', input_params, always_retry=always_retry, **kwargs) | python | def system_find_global_workflows(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findGlobalWorkflows API method.
"""
return DXHTTPRequest('/system/findGlobalWorkflows', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findGlobalWorkflows API method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1235-L1239 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_resolve_data_objects | def system_resolve_data_objects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/resolveDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/resolveDataObjects
"""
return DXHTTPRequest('/system/resolveDataObjects', input_params, always_retry=always_retry, **kwargs) | python | def system_resolve_data_objects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/resolveDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/resolveDataObjects
"""
return DXHTTPRequest('/system/resolveDataObjects', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/resolveDataObjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/resolveDataObjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1241-L1247 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_executions | def system_find_executions(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findExecutions API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindExecutions
"""
return DXHTTPRequest('/system/findExecutions', input_params, always_retry=always_retry, **kwargs) | python | def system_find_executions(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findExecutions API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindExecutions
"""
return DXHTTPRequest('/system/findExecutions', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findExecutions API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindExecutions | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1249-L1255 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_analyses | def system_find_analyses(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findAnalyses API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindAnalyses
"""
return DXHTTPRequest('/system/findAnalyses', input_params, always_retry=always_retry, **kwargs) | python | def system_find_analyses(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findAnalyses API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindAnalyses
"""
return DXHTTPRequest('/system/findAnalyses', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findAnalyses API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindAnalyses | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1257-L1263 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_databases | def system_find_databases(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findDatabases API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDatabases
"""
return DXHTTPRequest('/system/findDatabases', input_params, always_retry=always_retry, **kwargs) | python | def system_find_databases(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findDatabases API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDatabases
"""
return DXHTTPRequest('/system/findDatabases', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findDatabases API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDatabases | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1265-L1271 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_jobs | def system_find_jobs(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findJobs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindJobs
"""
return DXHTTPRequest('/system/findJobs', input_params, always_retry=always_retry, **kwargs) | python | def system_find_jobs(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findJobs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindJobs
"""
return DXHTTPRequest('/system/findJobs', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findJobs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindJobs | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1273-L1279 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_projects | def system_find_projects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindProjects
"""
return DXHTTPRequest('/system/findProjects', input_params, always_retry=always_retry, **kwargs) | python | def system_find_projects(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindProjects
"""
return DXHTTPRequest('/system/findProjects', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindProjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1281-L1287 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_users | def system_find_users(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findUsers API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers
"""
return DXHTTPRequest('/system/findUsers', input_params, always_retry=always_retry, **kwargs) | python | def system_find_users(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findUsers API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers
"""
return DXHTTPRequest('/system/findUsers', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findUsers API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1289-L1295 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_project_members | def system_find_project_members(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findProjectMembers API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findProjectMembers
"""
return DXHTTPRequest('/system/findProjectMembers', input_params, always_retry=always_retry, **kwargs) | python | def system_find_project_members(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findProjectMembers API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findProjectMembers
"""
return DXHTTPRequest('/system/findProjectMembers', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findProjectMembers API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findProjectMembers | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1297-L1303 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_find_orgs | def system_find_orgs(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findOrgs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findOrgs
"""
return DXHTTPRequest('/system/findOrgs', input_params, always_retry=always_retry, **kwargs) | python | def system_find_orgs(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/findOrgs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findOrgs
"""
return DXHTTPRequest('/system/findOrgs', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/findOrgs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findOrgs | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1305-L1311 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_generate_batch_inputs | def system_generate_batch_inputs(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/generateBatchInputs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/generateBatchInputs
"""
return DXHTTPRequest('/system/generateBatchInputs', input_params, always_retry=always_retry, **kwargs) | python | def system_generate_batch_inputs(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/generateBatchInputs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/generateBatchInputs
"""
return DXHTTPRequest('/system/generateBatchInputs', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/generateBatchInputs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/generateBatchInputs | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1313-L1319 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_global_search | def system_global_search(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/globalSearch API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/globalSearch
"""
return DXHTTPRequest('/system/globalSearch', input_params, always_retry=always_retry, **kwargs) | python | def system_global_search(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/globalSearch API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/globalSearch
"""
return DXHTTPRequest('/system/globalSearch', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/globalSearch API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/globalSearch | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1321-L1327 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_greet | def system_greet(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/greet API method.
"""
return DXHTTPRequest('/system/greet', input_params, always_retry=always_retry, **kwargs) | python | def system_greet(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/greet API method.
"""
return DXHTTPRequest('/system/greet', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/greet API method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1329-L1333 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_headers | def system_headers(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/headers API method.
"""
return DXHTTPRequest('/system/headers', input_params, always_retry=always_retry, **kwargs) | python | def system_headers(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/headers API method.
"""
return DXHTTPRequest('/system/headers', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/headers API method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1335-L1339 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_shorten_url | def system_shorten_url(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/shortenURL API method.
"""
return DXHTTPRequest('/system/shortenURL', input_params, always_retry=always_retry, **kwargs) | python | def system_shorten_url(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/shortenURL API method.
"""
return DXHTTPRequest('/system/shortenURL', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/shortenURL API method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1341-L1345 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | system_whoami | def system_whoami(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/whoami API method.
"""
return DXHTTPRequest('/system/whoami', input_params, always_retry=always_retry, **kwargs) | python | def system_whoami(input_params={}, always_retry=True, **kwargs):
"""
Invokes the /system/whoami API method.
"""
return DXHTTPRequest('/system/whoami', input_params, always_retry=always_retry, **kwargs) | Invokes the /system/whoami API method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1347-L1351 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | user_describe | def user_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /user-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def user_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /user-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /user-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fdescribe | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1353-L1359 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | user_update | def user_update(object_id, input_params={}, always_retry=False, **kwargs):
"""
Invokes the /user-xxxx/update API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate
"""
return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def user_update(object_id, input_params={}, always_retry=False, **kwargs):
"""
Invokes the /user-xxxx/update API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate
"""
return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /user-xxxx/update API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1361-L1367 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_add_stage | def workflow_add_stage(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/addStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FaddStage
"""
return DXHTTPRequest('/%s/addStage' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_add_stage(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/addStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FaddStage
"""
return DXHTTPRequest('/%s/addStage' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/addStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FaddStage | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1369-L1375 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_add_tags | def workflow_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/addTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
"""
return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_add_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/addTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
"""
return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/addTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1377-L1383 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_add_types | def workflow_add_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/addTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
"""
return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_add_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/addTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
"""
return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/addTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1385-L1391 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_close | def workflow_close(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/close API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
"""
return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_close(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/close API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
"""
return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/close API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1393-L1399 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_describe | def workflow_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_describe(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fdescribe
"""
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/describe API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fdescribe | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1401-L1407 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_dry_run | def workflow_dry_run(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/dryRun API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FdryRun
"""
return DXHTTPRequest('/%s/dryRun' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_dry_run(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/dryRun API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FdryRun
"""
return DXHTTPRequest('/%s/dryRun' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/dryRun API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FdryRun | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1409-L1415 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_get_details | def workflow_get_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/getDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
"""
return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_get_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/getDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
"""
return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/getDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1417-L1423 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_is_stage_compatible | def workflow_is_stage_compatible(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/isStageCompatible API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FisStageCompatible
"""
return DXHTTPRequest('/%s/isStageCompatible' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_is_stage_compatible(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/isStageCompatible API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FisStageCompatible
"""
return DXHTTPRequest('/%s/isStageCompatible' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/isStageCompatible API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FisStageCompatible | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1425-L1431 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_list_projects | def workflow_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/listProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects
"""
return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_list_projects(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/listProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects
"""
return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/listProjects API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1433-L1439 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_move_stage | def workflow_move_stage(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/moveStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FmoveStage
"""
return DXHTTPRequest('/%s/moveStage' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_move_stage(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/moveStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FmoveStage
"""
return DXHTTPRequest('/%s/moveStage' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/moveStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FmoveStage | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1441-L1447 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_overwrite | def workflow_overwrite(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/overwrite API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Foverwrite
"""
return DXHTTPRequest('/%s/overwrite' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_overwrite(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/overwrite API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Foverwrite
"""
return DXHTTPRequest('/%s/overwrite' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/overwrite API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Foverwrite | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1449-L1455 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_remove_stage | def workflow_remove_stage(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/removeStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FremoveStage
"""
return DXHTTPRequest('/%s/removeStage' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_remove_stage(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/removeStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FremoveStage
"""
return DXHTTPRequest('/%s/removeStage' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/removeStage API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FremoveStage | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1457-L1463 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_remove_tags | def workflow_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/removeTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags
"""
return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/removeTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags
"""
return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/removeTags API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1465-L1471 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_remove_types | def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/removeTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
"""
return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/removeTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
"""
return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/removeTypes API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1473-L1479 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_rename | def workflow_rename(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/rename API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
"""
return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_rename(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/rename API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
"""
return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/rename API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1481-L1487 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_validate_batch | def workflow_validate_batch(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/validateBatch API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FvalidateBatch
"""
return DXHTTPRequest('/%s/validateBatch' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_validate_batch(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/validateBatch API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FvalidateBatch
"""
return DXHTTPRequest('/%s/validateBatch' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/validateBatch API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FvalidateBatch | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1498-L1504 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_set_details | def workflow_set_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
"""
return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_set_details(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
"""
return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/setDetails API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1506-L1512 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_set_properties | def workflow_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setProperties API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
"""
return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setProperties API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
"""
return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/setProperties API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1514-L1520 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_set_stage_inputs | def workflow_set_stage_inputs(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setStageInputs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FsetStageInputs
"""
return DXHTTPRequest('/%s/setStageInputs' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_set_stage_inputs(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setStageInputs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FsetStageInputs
"""
return DXHTTPRequest('/%s/setStageInputs' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/setStageInputs API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FsetStageInputs | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1522-L1528 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_set_visibility | def workflow_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setVisibility API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
"""
return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_set_visibility(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/setVisibility API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
"""
return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/setVisibility API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1530-L1536 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_update | def workflow_update(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/update API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fupdate
"""
return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_update(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/update API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fupdate
"""
return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/update API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fupdate | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1538-L1544 |
dnanexus/dx-toolkit | src/python/dxpy/api.py | workflow_update_stage_executable | def workflow_update_stage_executable(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/updateStageExecutable API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FupdateStageExecutable
"""
return DXHTTPRequest('/%s/updateStageExecutable' % object_id, input_params, always_retry=always_retry, **kwargs) | python | def workflow_update_stage_executable(object_id, input_params={}, always_retry=True, **kwargs):
"""
Invokes the /workflow-xxxx/updateStageExecutable API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FupdateStageExecutable
"""
return DXHTTPRequest('/%s/updateStageExecutable' % object_id, input_params, always_retry=always_retry, **kwargs) | Invokes the /workflow-xxxx/updateStageExecutable API method.
For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FupdateStageExecutable | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1546-L1552 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | _image_to_data | def _image_to_data(img):
"""
Does the work of encoding an image into Base64
"""
# If the image is already encoded in Base64, we have nothing to do here
if "src" not in img.attrs or img["src"].startswith("data:"):
return
elif re.match("https?://", img["src"]):
img_data = _load_url(img["src"]).read()
else:
img_data = _load_file(img["src"]).read()
img_type = imghdr.what("", img_data)
img_b64 = base64.b64encode(img_data)
src_data = "data:image/none;base64,"
if img_type:
src_data = "data:image/{};base64,{}".format(img_type, img_b64)
img["src"] = src_data | python | def _image_to_data(img):
"""
Does the work of encoding an image into Base64
"""
# If the image is already encoded in Base64, we have nothing to do here
if "src" not in img.attrs or img["src"].startswith("data:"):
return
elif re.match("https?://", img["src"]):
img_data = _load_url(img["src"]).read()
else:
img_data = _load_file(img["src"]).read()
img_type = imghdr.what("", img_data)
img_b64 = base64.b64encode(img_data)
src_data = "data:image/none;base64,"
if img_type:
src_data = "data:image/{};base64,{}".format(img_type, img_b64)
img["src"] = src_data | Does the work of encoding an image into Base64 | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L45-L61 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | _bake_css | def _bake_css(link):
"""
Takes a link element and turns it into an inline style link if applicable
"""
if "href" in link.attrs and (re.search("\.css$", link["href"])) or ("rel" in link.attrs and link["rel"] is "stylesheet") or ("type" in link.attrs and link["type"] is "text/css"):
if re.match("https?://", link["href"]):
css_data = _load_url(link["href"]).read()
else:
css_data = _load_file(link["href"]).read()
link.clear()
if USING_PYTHON2:
link.string = css_data
else:
link.string = str(css_data)
link.name = "style"
del link["rel"]
del link["href"] | python | def _bake_css(link):
"""
Takes a link element and turns it into an inline style link if applicable
"""
if "href" in link.attrs and (re.search("\.css$", link["href"])) or ("rel" in link.attrs and link["rel"] is "stylesheet") or ("type" in link.attrs and link["type"] is "text/css"):
if re.match("https?://", link["href"]):
css_data = _load_url(link["href"]).read()
else:
css_data = _load_file(link["href"]).read()
link.clear()
if USING_PYTHON2:
link.string = css_data
else:
link.string = str(css_data)
link.name = "style"
del link["rel"]
del link["href"] | Takes a link element and turns it into an inline style link if applicable | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L64-L80 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | _bake_script | def _bake_script(script):
"""
Takes a script element and bakes it in only if it contains a remote resource
"""
if "src" in script.attrs:
if re.match("https?://", script["src"]):
script_data = _load_url(script["src"]).read()
else:
script_data = _load_file(script["src"]).read()
script.clear()
if USING_PYTHON2:
script.string = "\n" + script_data + "\n"
else:
script.string = "\n" + str(script_data) + "\n"
del script["src"]
del script["type"] | python | def _bake_script(script):
"""
Takes a script element and bakes it in only if it contains a remote resource
"""
if "src" in script.attrs:
if re.match("https?://", script["src"]):
script_data = _load_url(script["src"]).read()
else:
script_data = _load_file(script["src"]).read()
script.clear()
if USING_PYTHON2:
script.string = "\n" + script_data + "\n"
else:
script.string = "\n" + str(script_data) + "\n"
del script["src"]
del script["type"] | Takes a script element and bakes it in only if it contains a remote resource | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L83-L98 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | _load_file | def _load_file(path):
"""
Loads a file from the local filesystem
"""
if not os.path.exists(path):
parser.error("{} was not found!".format(path))
if USING_PYTHON2:
mode = "r"
else:
mode = "rb"
try:
f = open(path, mode)
return f
except IOError as ex:
parser.error("{path} could not be read due to an I/O error! ({ex})".format(path=path, ex=ex)) | python | def _load_file(path):
"""
Loads a file from the local filesystem
"""
if not os.path.exists(path):
parser.error("{} was not found!".format(path))
if USING_PYTHON2:
mode = "r"
else:
mode = "rb"
try:
f = open(path, mode)
return f
except IOError as ex:
parser.error("{path} could not be read due to an I/O error! ({ex})".format(path=path, ex=ex)) | Loads a file from the local filesystem | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L109-L123 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | _load_url | def _load_url(url):
"""
Loads a URL resource from a remote server
"""
try:
response = requests.get(url)
return BytesIO(response.content)
except IOError as ex:
parser.error("{url} could not be loaded remotely! ({ex})".format(url=url, ex=ex)) | python | def _load_url(url):
"""
Loads a URL resource from a remote server
"""
try:
response = requests.get(url)
return BytesIO(response.content)
except IOError as ex:
parser.error("{url} could not be loaded remotely! ({ex})".format(url=url, ex=ex)) | Loads a URL resource from a remote server | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L126-L134 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | _get_bs4_string | def _get_bs4_string(soup):
"""
Outputs a BeautifulSoup object as a string that should hopefully be minimally modified
"""
if len(soup.find_all("script")) == 0:
soup_str = soup.prettify(formatter=None).strip()
else:
soup_str = str(soup.html)
soup_str = re.sub("&", "&", soup_str)
soup_str = re.sub("<", "<", soup_str)
soup_str = re.sub(">", ">", soup_str)
return soup_str | python | def _get_bs4_string(soup):
"""
Outputs a BeautifulSoup object as a string that should hopefully be minimally modified
"""
if len(soup.find_all("script")) == 0:
soup_str = soup.prettify(formatter=None).strip()
else:
soup_str = str(soup.html)
soup_str = re.sub("&", "&", soup_str)
soup_str = re.sub("<", "<", soup_str)
soup_str = re.sub(">", ">", soup_str)
return soup_str | Outputs a BeautifulSoup object as a string that should hopefully be minimally modified | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L138-L149 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | bake | def bake(src):
"""
Runs the encoder on the given source file
"""
src = os.path.realpath(src)
path = os.path.dirname(src)
filename = os.path.basename(src)
html = _load_file(src).read()
if imghdr.what("", html):
html = "<html><body><img src='{}'/></body></html>".format(cgi.escape(filename))
# Change to the file's directory so image files with relative paths can be loaded correctly
cwd = os.getcwd()
os.chdir(path)
bs_html = bs4.BeautifulSoup(html, "html.parser")
images = bs_html.find_all("img")
for image in images:
_image_to_data(image)
for link in bs_html.find_all("link"):
_bake_css(link)
for script in bs_html.find_all("script"):
_bake_script(script)
os.chdir(cwd)
return bs_html | python | def bake(src):
"""
Runs the encoder on the given source file
"""
src = os.path.realpath(src)
path = os.path.dirname(src)
filename = os.path.basename(src)
html = _load_file(src).read()
if imghdr.what("", html):
html = "<html><body><img src='{}'/></body></html>".format(cgi.escape(filename))
# Change to the file's directory so image files with relative paths can be loaded correctly
cwd = os.getcwd()
os.chdir(path)
bs_html = bs4.BeautifulSoup(html, "html.parser")
images = bs_html.find_all("img")
for image in images:
_image_to_data(image)
for link in bs_html.find_all("link"):
_bake_css(link)
for script in bs_html.find_all("script"):
_bake_script(script)
os.chdir(cwd)
return bs_html | Runs the encoder on the given source file | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L152-L175 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | upload_html | def upload_html(destination, html, name=None):
"""
Uploads the HTML to a file on the server
"""
[project, path, n] = parse_destination(destination)
try:
dxfile = dxpy.upload_string(html, media_type="text/html", project=project, folder=path, hidden=True, name=name or None)
return dxfile.get_id()
except dxpy.DXAPIError as ex:
parser.error("Could not upload HTML report to DNAnexus server! ({ex})".format(ex=ex)) | python | def upload_html(destination, html, name=None):
"""
Uploads the HTML to a file on the server
"""
[project, path, n] = parse_destination(destination)
try:
dxfile = dxpy.upload_string(html, media_type="text/html", project=project, folder=path, hidden=True, name=name or None)
return dxfile.get_id()
except dxpy.DXAPIError as ex:
parser.error("Could not upload HTML report to DNAnexus server! ({ex})".format(ex=ex)) | Uploads the HTML to a file on the server | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L178-L187 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | create_record | def create_record(destination, file_ids, width=None, height=None):
"""
Creates a master record for the HTML report; this doesn't contain contain the actual HTML, but reports
are required to be records rather than files and we can link more than one HTML file to a report
"""
[project, path, name] = parse_destination(destination)
files = [dxpy.dxlink(file_id) for file_id in file_ids]
details = {"files": files}
if width:
details["width"] = width
if height:
details["height"] = height
try:
dxrecord = dxpy.new_dxrecord(project=project, folder=path, types=["Report", "HTMLReport"], details=details, name=name)
dxrecord.close()
return dxrecord.get_id()
except dxpy.DXAPIError as ex:
parser.error("Could not create an HTML report record on DNAnexus servers! ({ex})".format(ex=ex)) | python | def create_record(destination, file_ids, width=None, height=None):
"""
Creates a master record for the HTML report; this doesn't contain contain the actual HTML, but reports
are required to be records rather than files and we can link more than one HTML file to a report
"""
[project, path, name] = parse_destination(destination)
files = [dxpy.dxlink(file_id) for file_id in file_ids]
details = {"files": files}
if width:
details["width"] = width
if height:
details["height"] = height
try:
dxrecord = dxpy.new_dxrecord(project=project, folder=path, types=["Report", "HTMLReport"], details=details, name=name)
dxrecord.close()
return dxrecord.get_id()
except dxpy.DXAPIError as ex:
parser.error("Could not create an HTML report record on DNAnexus servers! ({ex})".format(ex=ex)) | Creates a master record for the HTML report; this doesn't contain contain the actual HTML, but reports
are required to be records rather than files and we can link more than one HTML file to a report | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L190-L207 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_report_html.py | save | def save(filename, html):
"""
Creates a baked HTML file on the local system
"""
try:
out_file = open(filename, "w")
out_file.write(html)
out_file.close()
except IOError as ex:
parser.error("Could not write baked HTML to local file {name}. ({ex})".format(name=filename, ex=ex)) | python | def save(filename, html):
"""
Creates a baked HTML file on the local system
"""
try:
out_file = open(filename, "w")
out_file.write(html)
out_file.close()
except IOError as ex:
parser.error("Could not write baked HTML to local file {name}. ({ex})".format(name=filename, ex=ex)) | Creates a baked HTML file on the local system | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_report_html.py#L210-L219 |
dnanexus/dx-toolkit | src/python/dxpy/utils/describe.py | get_size_str | def get_size_str(size):
"""
Formats a byte size as a string.
The returned string is no more than 9 characters long.
"""
if size == 0:
magnitude = 0
level = 0
else:
magnitude = math.floor(math.log(size, 10))
level = int(min(math.floor(magnitude // 3), 4))
return ('%d' if level == 0 else '%.2f') % (float(size) / 2**(level*10)) + ' ' + SIZE_LEVEL[level] | python | def get_size_str(size):
"""
Formats a byte size as a string.
The returned string is no more than 9 characters long.
"""
if size == 0:
magnitude = 0
level = 0
else:
magnitude = math.floor(math.log(size, 10))
level = int(min(math.floor(magnitude // 3), 4))
return ('%d' if level == 0 else '%.2f') % (float(size) / 2**(level*10)) + ' ' + SIZE_LEVEL[level] | Formats a byte size as a string.
The returned string is no more than 9 characters long. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/describe.py#L60-L72 |
dnanexus/dx-toolkit | src/python/dxpy/utils/describe.py | is_job_ref | def is_job_ref(thing, reftype=dict):
'''
:param thing: something that might be a job-based object reference hash
:param reftype: type that a job-based object reference would be (default is dict)
'''
return isinstance(thing, reftype) and \
((len(thing) == 2 and \
isinstance(thing.get('field'), basestring) and \
isinstance(thing.get('job'), basestring)) or \
(len(thing) == 1 and \
isinstance(thing.get('$dnanexus_link'), reftype) and \
isinstance(thing['$dnanexus_link'].get('field'), basestring) and \
isinstance(thing['$dnanexus_link'].get('job'), basestring))) | python | def is_job_ref(thing, reftype=dict):
'''
:param thing: something that might be a job-based object reference hash
:param reftype: type that a job-based object reference would be (default is dict)
'''
return isinstance(thing, reftype) and \
((len(thing) == 2 and \
isinstance(thing.get('field'), basestring) and \
isinstance(thing.get('job'), basestring)) or \
(len(thing) == 1 and \
isinstance(thing.get('$dnanexus_link'), reftype) and \
isinstance(thing['$dnanexus_link'].get('field'), basestring) and \
isinstance(thing['$dnanexus_link'].get('job'), basestring))) | :param thing: something that might be a job-based object reference hash
:param reftype: type that a job-based object reference would be (default is dict) | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/describe.py#L161-L173 |
dnanexus/dx-toolkit | src/python/dxpy/utils/describe.py | print_desc | def print_desc(desc, verbose=False):
'''
:param desc: The describe hash of a DNAnexus entity
:type desc: dict
Depending on the class of the entity, this method will print a
formatted and human-readable string containing the data in *desc*.
'''
if desc['class'] in ['project', 'workspace', 'container']:
print_project_desc(desc, verbose=verbose)
elif desc['class'] == 'app':
print_app_desc(desc, verbose=verbose)
elif desc['class'] == 'globalworkflow':
print_globalworkflow_desc(desc, verbose=verbose)
elif desc['class'] in ['job', 'analysis']:
print_execution_desc(desc)
elif desc['class'] == 'user':
print_user_desc(desc)
elif desc['class'] in ['org', 'team']:
print_generic_desc(desc)
else:
print_data_obj_desc(desc, verbose=verbose) | python | def print_desc(desc, verbose=False):
'''
:param desc: The describe hash of a DNAnexus entity
:type desc: dict
Depending on the class of the entity, this method will print a
formatted and human-readable string containing the data in *desc*.
'''
if desc['class'] in ['project', 'workspace', 'container']:
print_project_desc(desc, verbose=verbose)
elif desc['class'] == 'app':
print_app_desc(desc, verbose=verbose)
elif desc['class'] == 'globalworkflow':
print_globalworkflow_desc(desc, verbose=verbose)
elif desc['class'] in ['job', 'analysis']:
print_execution_desc(desc)
elif desc['class'] == 'user':
print_user_desc(desc)
elif desc['class'] in ['org', 'team']:
print_generic_desc(desc)
else:
print_data_obj_desc(desc, verbose=verbose) | :param desc: The describe hash of a DNAnexus entity
:type desc: dict
Depending on the class of the entity, this method will print a
formatted and human-readable string containing the data in *desc*. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/describe.py#L939-L960 |
dnanexus/dx-toolkit | src/python/dxpy/utils/describe.py | get_ls_l_desc | def get_ls_l_desc(desc, include_folder=False, include_project=False):
"""
desc must have at least all the fields given by get_ls_l_desc_fields.
"""
# If you make this method consume an additional field, you must add it to
# get_ls_l_desc_fields above.
if 'state' in desc:
state_len = len(desc['state'])
if desc['state'] != 'closed':
state_str = YELLOW() + desc['state'] + ENDC()
else:
state_str = GREEN() + desc['state'] + ENDC()
else:
state_str = ''
state_len = 0
name_str = ''
if include_folder:
name_str += desc['folder'] + ('/' if desc['folder'] != '/' else '')
name_str += desc['name']
if desc['class'] in ['applet', 'workflow']:
name_str = BOLD() + GREEN() + name_str + ENDC()
size_str = ''
if 'size' in desc and desc['class'] == 'file':
size_str = get_size_str(desc['size'])
elif 'length' in desc:
size_str = str(desc['length']) + ' rows'
size_padding = ' ' * max(0, 9 - len(size_str))
return (state_str +
DELIMITER(' '*(8 - state_len)) + render_short_timestamp(desc['modified']) +
DELIMITER(' ') + size_str +
DELIMITER(size_padding + ' ') + name_str +
DELIMITER(' (') + ((desc['project'] + DELIMITER(':')) if include_project else '') + desc['id'] +
DELIMITER(')')) | python | def get_ls_l_desc(desc, include_folder=False, include_project=False):
"""
desc must have at least all the fields given by get_ls_l_desc_fields.
"""
# If you make this method consume an additional field, you must add it to
# get_ls_l_desc_fields above.
if 'state' in desc:
state_len = len(desc['state'])
if desc['state'] != 'closed':
state_str = YELLOW() + desc['state'] + ENDC()
else:
state_str = GREEN() + desc['state'] + ENDC()
else:
state_str = ''
state_len = 0
name_str = ''
if include_folder:
name_str += desc['folder'] + ('/' if desc['folder'] != '/' else '')
name_str += desc['name']
if desc['class'] in ['applet', 'workflow']:
name_str = BOLD() + GREEN() + name_str + ENDC()
size_str = ''
if 'size' in desc and desc['class'] == 'file':
size_str = get_size_str(desc['size'])
elif 'length' in desc:
size_str = str(desc['length']) + ' rows'
size_padding = ' ' * max(0, 9 - len(size_str))
return (state_str +
DELIMITER(' '*(8 - state_len)) + render_short_timestamp(desc['modified']) +
DELIMITER(' ') + size_str +
DELIMITER(size_padding + ' ') + name_str +
DELIMITER(' (') + ((desc['project'] + DELIMITER(':')) if include_project else '') + desc['id'] +
DELIMITER(')')) | desc must have at least all the fields given by get_ls_l_desc_fields. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/describe.py#L1002-L1039 |
dnanexus/dx-toolkit | src/python/dxpy/utils/describe.py | get_find_executions_string | def get_find_executions_string(desc, has_children, single_result=False, show_outputs=True,
is_cached_result=False):
'''
:param desc: hash of execution's describe output
:param has_children: whether the execution has children to be printed
:param single_result: whether the execution is displayed as a single result or as part of an execution tree
:param is_cached_result: whether the execution should be formatted as a cached result
'''
is_not_subjob = desc['parentJob'] is None or desc['class'] == 'analysis' or single_result
result = ("* " if is_not_subjob and get_delimiter() is None else "")
canonical_execution_name = desc['executableName']
if desc['class'] == 'job':
canonical_execution_name += ":" + desc['function']
execution_name = desc.get('name', '<no name>')
# Format the name of the execution
if is_cached_result:
result += BOLD() + "[" + ENDC()
result += BOLD() + BLUE()
if desc['class'] == 'analysis':
result += UNDERLINE()
result += execution_name + ENDC()
if execution_name != canonical_execution_name and execution_name+":main" != canonical_execution_name:
result += ' (' + canonical_execution_name + ')'
if is_cached_result:
result += BOLD() + "]" + ENDC()
# Format state
result += DELIMITER(' (') + JOB_STATES(desc['state']) + DELIMITER(') ') + desc['id']
# Add unicode pipe to child if necessary
result += DELIMITER('\n' + (u'│ ' if is_not_subjob and has_children else (" " if is_not_subjob else "")))
result += desc['launchedBy'][5:] + DELIMITER(' ')
result += render_short_timestamp(desc['created'])
cached_and_runtime_strs = []
if is_cached_result:
cached_and_runtime_strs.append(YELLOW() + "cached" + ENDC())
if desc['class'] == 'job':
# Only print runtime if it ever started running
if desc.get('startedRunning'):
if desc['state'] in ['done', 'failed', 'terminated', 'waiting_on_output']:
runtime = datetime.timedelta(seconds=int(desc['stoppedRunning']-desc['startedRunning'])//1000)
cached_and_runtime_strs.append("runtime " + str(runtime))
elif desc['state'] == 'running':
seconds_running = max(int(time.time()-desc['startedRunning']//1000), 0)
msg = "running for {rt}".format(rt=datetime.timedelta(seconds=seconds_running))
cached_and_runtime_strs.append(msg)
if cached_and_runtime_strs:
result += " (" + ", ".join(cached_and_runtime_strs) + ")"
if show_outputs:
prefix = DELIMITER('\n' + (u'│ ' if is_not_subjob and has_children else (" " if is_not_subjob else "")))
if desc.get("output") != None:
result += job_output_to_str(desc['output'], prefix=prefix)
elif desc['state'] == 'failed' and 'failureReason' in desc:
result += prefix + BOLD() + desc['failureReason'] + ENDC() + ": " + fill(desc.get('failureMessage', ''),
subsequent_indent=prefix.lstrip('\n'))
return result | python | def get_find_executions_string(desc, has_children, single_result=False, show_outputs=True,
is_cached_result=False):
'''
:param desc: hash of execution's describe output
:param has_children: whether the execution has children to be printed
:param single_result: whether the execution is displayed as a single result or as part of an execution tree
:param is_cached_result: whether the execution should be formatted as a cached result
'''
is_not_subjob = desc['parentJob'] is None or desc['class'] == 'analysis' or single_result
result = ("* " if is_not_subjob and get_delimiter() is None else "")
canonical_execution_name = desc['executableName']
if desc['class'] == 'job':
canonical_execution_name += ":" + desc['function']
execution_name = desc.get('name', '<no name>')
# Format the name of the execution
if is_cached_result:
result += BOLD() + "[" + ENDC()
result += BOLD() + BLUE()
if desc['class'] == 'analysis':
result += UNDERLINE()
result += execution_name + ENDC()
if execution_name != canonical_execution_name and execution_name+":main" != canonical_execution_name:
result += ' (' + canonical_execution_name + ')'
if is_cached_result:
result += BOLD() + "]" + ENDC()
# Format state
result += DELIMITER(' (') + JOB_STATES(desc['state']) + DELIMITER(') ') + desc['id']
# Add unicode pipe to child if necessary
result += DELIMITER('\n' + (u'│ ' if is_not_subjob and has_children else (" " if is_not_subjob else "")))
result += desc['launchedBy'][5:] + DELIMITER(' ')
result += render_short_timestamp(desc['created'])
cached_and_runtime_strs = []
if is_cached_result:
cached_and_runtime_strs.append(YELLOW() + "cached" + ENDC())
if desc['class'] == 'job':
# Only print runtime if it ever started running
if desc.get('startedRunning'):
if desc['state'] in ['done', 'failed', 'terminated', 'waiting_on_output']:
runtime = datetime.timedelta(seconds=int(desc['stoppedRunning']-desc['startedRunning'])//1000)
cached_and_runtime_strs.append("runtime " + str(runtime))
elif desc['state'] == 'running':
seconds_running = max(int(time.time()-desc['startedRunning']//1000), 0)
msg = "running for {rt}".format(rt=datetime.timedelta(seconds=seconds_running))
cached_and_runtime_strs.append(msg)
if cached_and_runtime_strs:
result += " (" + ", ".join(cached_and_runtime_strs) + ")"
if show_outputs:
prefix = DELIMITER('\n' + (u'│ ' if is_not_subjob and has_children else (" " if is_not_subjob else "")))
if desc.get("output") != None:
result += job_output_to_str(desc['output'], prefix=prefix)
elif desc['state'] == 'failed' and 'failureReason' in desc:
result += prefix + BOLD() + desc['failureReason'] + ENDC() + ": " + fill(desc.get('failureMessage', ''),
subsequent_indent=prefix.lstrip('\n'))
return result | :param desc: hash of execution's describe output
:param has_children: whether the execution has children to be printed
:param single_result: whether the execution is displayed as a single result or as part of an execution tree
:param is_cached_result: whether the execution should be formatted as a cached result | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/describe.py#L1046-L1110 |
dnanexus/dx-toolkit | src/python/dxpy/system_requirements.py | SystemRequirementsDict.from_instance_count | def from_instance_count(cls, instance_count_arg, entrypoint="*"):
"""
Returns a SystemRequirementsDict that can be passed as a
"systemRequirements" input to job/new or run/ API calls.
The instance_count_arg should be either a:
* string or int eg. "6" or 8
* dictionary, eg. {"main": 4, "other_function": 2}
"""
try:
if instance_count_arg is None:
return cls(None)
if isinstance(instance_count_arg, basestring) or isinstance(instance_count_arg, int):
return cls({entrypoint: {"clusterSpec": {"initialInstanceCount": int(instance_count_arg)}}})
if isinstance(instance_count_arg, dict):
return cls({k: {"clusterSpec": {"initialInstanceCount": int(v)}} for k, v in instance_count_arg.items()})
raise ValueError
except ValueError:
DXError('Expected instance_count field to be either an int, string or a dict') | python | def from_instance_count(cls, instance_count_arg, entrypoint="*"):
"""
Returns a SystemRequirementsDict that can be passed as a
"systemRequirements" input to job/new or run/ API calls.
The instance_count_arg should be either a:
* string or int eg. "6" or 8
* dictionary, eg. {"main": 4, "other_function": 2}
"""
try:
if instance_count_arg is None:
return cls(None)
if isinstance(instance_count_arg, basestring) or isinstance(instance_count_arg, int):
return cls({entrypoint: {"clusterSpec": {"initialInstanceCount": int(instance_count_arg)}}})
if isinstance(instance_count_arg, dict):
return cls({k: {"clusterSpec": {"initialInstanceCount": int(v)}} for k, v in instance_count_arg.items()})
raise ValueError
except ValueError:
DXError('Expected instance_count field to be either an int, string or a dict') | Returns a SystemRequirementsDict that can be passed as a
"systemRequirements" input to job/new or run/ API calls.
The instance_count_arg should be either a:
* string or int eg. "6" or 8
* dictionary, eg. {"main": 4, "other_function": 2} | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/system_requirements.py#L40-L57 |
dnanexus/dx-toolkit | src/python/dxpy/system_requirements.py | SystemRequirementsDict.from_instance_type | def from_instance_type(cls, instance_type_arg, entrypoint="*"):
"""
Returns SystemRequirementsDict that can be passed as a
"systemRequirements" input to job/new or run/ API calls.
The instance_type_arg should be either a:
* string, eg. mem1_ssd1_x2
* dictionary, eg. {"main": "mem2_hdd2_x2", "other_function": "mem2_hdd2_x1"}
"""
if instance_type_arg is None:
return cls(None)
if isinstance(instance_type_arg, basestring):
# By default, all entry points ("*") should use this instance type
return cls({entrypoint: {"instanceType": instance_type_arg}})
if isinstance(instance_type_arg, dict):
# instance_type is a map of entry point to instance type
return cls({fn: {"instanceType": fn_inst} for fn, fn_inst in instance_type_arg.items()})
raise DXError('Expected instance_type field to be either a string or a dict') | python | def from_instance_type(cls, instance_type_arg, entrypoint="*"):
"""
Returns SystemRequirementsDict that can be passed as a
"systemRequirements" input to job/new or run/ API calls.
The instance_type_arg should be either a:
* string, eg. mem1_ssd1_x2
* dictionary, eg. {"main": "mem2_hdd2_x2", "other_function": "mem2_hdd2_x1"}
"""
if instance_type_arg is None:
return cls(None)
if isinstance(instance_type_arg, basestring):
# By default, all entry points ("*") should use this instance type
return cls({entrypoint: {"instanceType": instance_type_arg}})
if isinstance(instance_type_arg, dict):
# instance_type is a map of entry point to instance type
return cls({fn: {"instanceType": fn_inst} for fn, fn_inst in instance_type_arg.items()})
raise DXError('Expected instance_type field to be either a string or a dict') | Returns SystemRequirementsDict that can be passed as a
"systemRequirements" input to job/new or run/ API calls.
The instance_type_arg should be either a:
* string, eg. mem1_ssd1_x2
* dictionary, eg. {"main": "mem2_hdd2_x2", "other_function": "mem2_hdd2_x1"} | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/system_requirements.py#L60-L76 |
dnanexus/dx-toolkit | src/python/dxpy/system_requirements.py | SystemRequirementsDict.from_sys_requirements | def from_sys_requirements(cls, system_requirements, _type='all'):
"""
Returns SystemRequirementsDict encapsulating system requirements.
It can extract only entrypoints with specific fields ('clusterSpec',
'instanceType', etc), depending on the value of _type.
"""
if _type not in ('all', 'clusterSpec', 'instanceType'):
raise DXError("Expected '_type' to be either 'all', 'clusterSpec', or 'instanceType'")
if _type == 'all':
return cls(system_requirements)
extracted = defaultdict(dict)
for entrypoint, req in system_requirements.items():
if _type in req:
extracted[entrypoint][_type] = req[_type]
return cls(dict(extracted)) | python | def from_sys_requirements(cls, system_requirements, _type='all'):
"""
Returns SystemRequirementsDict encapsulating system requirements.
It can extract only entrypoints with specific fields ('clusterSpec',
'instanceType', etc), depending on the value of _type.
"""
if _type not in ('all', 'clusterSpec', 'instanceType'):
raise DXError("Expected '_type' to be either 'all', 'clusterSpec', or 'instanceType'")
if _type == 'all':
return cls(system_requirements)
extracted = defaultdict(dict)
for entrypoint, req in system_requirements.items():
if _type in req:
extracted[entrypoint][_type] = req[_type]
return cls(dict(extracted)) | Returns SystemRequirementsDict encapsulating system requirements.
It can extract only entrypoints with specific fields ('clusterSpec',
'instanceType', etc), depending on the value of _type. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/system_requirements.py#L79-L95 |
dnanexus/dx-toolkit | src/python/dxpy/system_requirements.py | SystemRequirementsDict.override_cluster_spec | def override_cluster_spec(self, srd):
"""
Returns SystemRequirementsDict can be passed in a "systemRequirements"
input to app-xxx/run, e.g. {'fn': {'clusterSpec': {initialInstanceCount: 3, version: "2.4.0", ..}}}
Since full clusterSpec must be passed to the API server, we need to retrieve the cluster
spec defined in app doc's systemRequirements and overwrite the field initialInstanceCount
with the value the user passed to dx run for each entrypoint.
initialInstanceCount is currently the only clusterSpec's field the user is allowed to change
at runtime.
A few scenarios when requesting instance count for different entrypoints with dx run
and the resulting merged systemRequirements (merged_cluster_spec). The bootstapScript
field here is only one of many (version, ports, etc) that should be copied from app
spec to merged_cluster_spec:
Requested: {"*": 5}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 5, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 5, bootstrapScript: "y.sh"}}
Requested: {"*": 15}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"},
"*": "clusterSpec": {"initialInstanceCount": 11, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "y.sh"},
"*": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "y.sh"}}
Requested: {"main": 12}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 12, bootstrapScript: "x.sh"}}
Requested: {"main": 33}
App doc: {"*": "clusterSpec": {"initialInstanceCount": 2, bootstrapScript: "z.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 33, bootstrapScript: "z.sh"}}
Requested: {"main": 22, "*": 11}
App doc: {"*": "clusterSpec": {"initialInstanceCount": 2, bootstrapScript: "t.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 22, bootstrapScript: "t.sh"},
"*": "clusterSpec": {"initialInstanceCount": 11, bootstrapScript: "t.sh"}}
"""
merged_cluster_spec = copy.deepcopy(self.entrypoints)
# Remove entrypoints without "clusterSpec"
merged_cluster_spec = dict([(k, v) for k, v in merged_cluster_spec.items() if v.get("clusterSpec") is not None])
# Remove entrypoints not provided in requested instance counts
merged_cluster_spec = dict([(k, v) for k, v in merged_cluster_spec.items() if \
k in srd.entrypoints or "*" in srd.entrypoints])
# Overwrite values of self.entrypoints.clusterSpec with the ones from srd
# Named entrypoint takes precedence over the wildcard
for entry_pt, req in merged_cluster_spec.items():
merged_cluster_spec[entry_pt]["clusterSpec"].update(
srd.entrypoints.get(entry_pt, srd.entrypoints.get("*"))["clusterSpec"])
# Check if all entrypoints in srd are included in merged_cluster_spec
# (if a named entrypoint was used in srd and such an entrypoint doesn't exist
# in app sys req, we need to take the cluster spec from the app's "*", if it exists)
for entry_pt, req in srd.entrypoints.items():
if entry_pt not in merged_cluster_spec and "*" in self.entrypoints and "clusterSpec" in self.entrypoints["*"]:
merged_cluster_spec[entry_pt] = {"clusterSpec": copy.deepcopy(self.entrypoints["*"]["clusterSpec"])}
merged_cluster_spec[entry_pt]["clusterSpec"].update(req["clusterSpec"])
return SystemRequirementsDict(merged_cluster_spec) | python | def override_cluster_spec(self, srd):
"""
Returns SystemRequirementsDict can be passed in a "systemRequirements"
input to app-xxx/run, e.g. {'fn': {'clusterSpec': {initialInstanceCount: 3, version: "2.4.0", ..}}}
Since full clusterSpec must be passed to the API server, we need to retrieve the cluster
spec defined in app doc's systemRequirements and overwrite the field initialInstanceCount
with the value the user passed to dx run for each entrypoint.
initialInstanceCount is currently the only clusterSpec's field the user is allowed to change
at runtime.
A few scenarios when requesting instance count for different entrypoints with dx run
and the resulting merged systemRequirements (merged_cluster_spec). The bootstapScript
field here is only one of many (version, ports, etc) that should be copied from app
spec to merged_cluster_spec:
Requested: {"*": 5}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 5, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 5, bootstrapScript: "y.sh"}}
Requested: {"*": 15}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"},
"*": "clusterSpec": {"initialInstanceCount": 11, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "y.sh"},
"*": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "y.sh"}}
Requested: {"main": 12}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 12, bootstrapScript: "x.sh"}}
Requested: {"main": 33}
App doc: {"*": "clusterSpec": {"initialInstanceCount": 2, bootstrapScript: "z.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 33, bootstrapScript: "z.sh"}}
Requested: {"main": 22, "*": 11}
App doc: {"*": "clusterSpec": {"initialInstanceCount": 2, bootstrapScript: "t.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 22, bootstrapScript: "t.sh"},
"*": "clusterSpec": {"initialInstanceCount": 11, bootstrapScript: "t.sh"}}
"""
merged_cluster_spec = copy.deepcopy(self.entrypoints)
# Remove entrypoints without "clusterSpec"
merged_cluster_spec = dict([(k, v) for k, v in merged_cluster_spec.items() if v.get("clusterSpec") is not None])
# Remove entrypoints not provided in requested instance counts
merged_cluster_spec = dict([(k, v) for k, v in merged_cluster_spec.items() if \
k in srd.entrypoints or "*" in srd.entrypoints])
# Overwrite values of self.entrypoints.clusterSpec with the ones from srd
# Named entrypoint takes precedence over the wildcard
for entry_pt, req in merged_cluster_spec.items():
merged_cluster_spec[entry_pt]["clusterSpec"].update(
srd.entrypoints.get(entry_pt, srd.entrypoints.get("*"))["clusterSpec"])
# Check if all entrypoints in srd are included in merged_cluster_spec
# (if a named entrypoint was used in srd and such an entrypoint doesn't exist
# in app sys req, we need to take the cluster spec from the app's "*", if it exists)
for entry_pt, req in srd.entrypoints.items():
if entry_pt not in merged_cluster_spec and "*" in self.entrypoints and "clusterSpec" in self.entrypoints["*"]:
merged_cluster_spec[entry_pt] = {"clusterSpec": copy.deepcopy(self.entrypoints["*"]["clusterSpec"])}
merged_cluster_spec[entry_pt]["clusterSpec"].update(req["clusterSpec"])
return SystemRequirementsDict(merged_cluster_spec) | Returns SystemRequirementsDict can be passed in a "systemRequirements"
input to app-xxx/run, e.g. {'fn': {'clusterSpec': {initialInstanceCount: 3, version: "2.4.0", ..}}}
Since full clusterSpec must be passed to the API server, we need to retrieve the cluster
spec defined in app doc's systemRequirements and overwrite the field initialInstanceCount
with the value the user passed to dx run for each entrypoint.
initialInstanceCount is currently the only clusterSpec's field the user is allowed to change
at runtime.
A few scenarios when requesting instance count for different entrypoints with dx run
and the resulting merged systemRequirements (merged_cluster_spec). The bootstapScript
field here is only one of many (version, ports, etc) that should be copied from app
spec to merged_cluster_spec:
Requested: {"*": 5}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 5, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 5, bootstrapScript: "y.sh"}}
Requested: {"*": 15}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"},
"*": "clusterSpec": {"initialInstanceCount": 11, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "y.sh"},
"*": "clusterSpec": {"initialInstanceCount": 15, bootstrapScript: "y.sh"}}
Requested: {"main": 12}
App doc: {"main": "clusterSpec": {"initialInstanceCount": 7, bootstrapScript: "x.sh"},
"other": "clusterSpec": {"initialInstanceCount": 9, bootstrapScript: "y.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 12, bootstrapScript: "x.sh"}}
Requested: {"main": 33}
App doc: {"*": "clusterSpec": {"initialInstanceCount": 2, bootstrapScript: "z.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 33, bootstrapScript: "z.sh"}}
Requested: {"main": 22, "*": 11}
App doc: {"*": "clusterSpec": {"initialInstanceCount": 2, bootstrapScript: "t.sh"}}
Merged: {"main": "clusterSpec": {"initialInstanceCount": 22, bootstrapScript: "t.sh"},
"*": "clusterSpec": {"initialInstanceCount": 11, bootstrapScript: "t.sh"}} | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/system_requirements.py#L97-L163 |
dnanexus/dx-toolkit | src/python/dxpy/system_requirements.py | SystemRequirementsDict._add_dict_values | def _add_dict_values(self, d1, d2):
"""
Merges the values of two dictionaries, which are expected to be dictionaries, e.g
d1 = {'a': {'x': pqr}}
d2 = {'a': {'y': lmn}, 'b': {'y': rst}}
will return: {'a': {'x': pqr, 'y': lmn}, 'b': {'y': rst}}.
Collisions of the keys of the sub-dictionaries are not checked.
"""
if d1 is None and d2 is None:
return None
d1 = d1 or {}
d2 = d2 or {}
added = {}
for key in set(list(d1.keys()) + list(d2.keys())):
added[key] = dict(d1.get(key, {}), **(d2.get(key, {})))
return added | python | def _add_dict_values(self, d1, d2):
"""
Merges the values of two dictionaries, which are expected to be dictionaries, e.g
d1 = {'a': {'x': pqr}}
d2 = {'a': {'y': lmn}, 'b': {'y': rst}}
will return: {'a': {'x': pqr, 'y': lmn}, 'b': {'y': rst}}.
Collisions of the keys of the sub-dictionaries are not checked.
"""
if d1 is None and d2 is None:
return None
d1 = d1 or {}
d2 = d2 or {}
added = {}
for key in set(list(d1.keys()) + list(d2.keys())):
added[key] = dict(d1.get(key, {}), **(d2.get(key, {})))
return added | Merges the values of two dictionaries, which are expected to be dictionaries, e.g
d1 = {'a': {'x': pqr}}
d2 = {'a': {'y': lmn}, 'b': {'y': rst}}
will return: {'a': {'x': pqr, 'y': lmn}, 'b': {'y': rst}}.
Collisions of the keys of the sub-dictionaries are not checked. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/system_requirements.py#L165-L183 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxrecord.py | new_dxrecord | def new_dxrecord(details=None, **kwargs):
'''
:rtype: :class:`DXRecord`
:param details: The contents of the record to be created.
:type details: dict
Additional optional parameters not listed: all those under
:func:`dxpy.bindings.DXDataObject.new`, except `details`.
Creates a new remote record object with project set to *project*
and returns the appropriate handler.
Example:
r = dxpy.new_dxrecord({"x": 1, "y": 2})
Note that this function is shorthand for::
dxrecord = DXRecord()
dxrecord.new(**kwargs)
'''
dxrecord = DXRecord()
dxrecord.new(details=details, **kwargs)
return dxrecord | python | def new_dxrecord(details=None, **kwargs):
'''
:rtype: :class:`DXRecord`
:param details: The contents of the record to be created.
:type details: dict
Additional optional parameters not listed: all those under
:func:`dxpy.bindings.DXDataObject.new`, except `details`.
Creates a new remote record object with project set to *project*
and returns the appropriate handler.
Example:
r = dxpy.new_dxrecord({"x": 1, "y": 2})
Note that this function is shorthand for::
dxrecord = DXRecord()
dxrecord.new(**kwargs)
'''
dxrecord = DXRecord()
dxrecord.new(details=details, **kwargs)
return dxrecord | :rtype: :class:`DXRecord`
:param details: The contents of the record to be created.
:type details: dict
Additional optional parameters not listed: all those under
:func:`dxpy.bindings.DXDataObject.new`, except `details`.
Creates a new remote record object with project set to *project*
and returns the appropriate handler.
Example:
r = dxpy.new_dxrecord({"x": 1, "y": 2})
Note that this function is shorthand for::
dxrecord = DXRecord()
dxrecord.new(**kwargs) | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxrecord.py#L32-L57 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxrecord.py | DXRecord._new | def _new(self, dx_hash, close=False, **kwargs):
"""
:param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
:type dx_hash: dict
:param init_from: Record from which to initialize the metadata
:type init_from: :class:`DXRecord`
:param close: Whether or not to close the record immediately after creating it
:type close: boolean
Create a new remote record object.
"""
if "init_from" in kwargs:
if kwargs["init_from"] is not None:
if not isinstance(kwargs["init_from"], DXRecord):
raise DXError("Expected instance of DXRecord to init_from")
dx_hash["initializeFrom"] = \
{"id": kwargs["init_from"].get_id(),
"project": kwargs["init_from"].get_proj_id()}
del kwargs["init_from"]
if close:
dx_hash["close"] = True
resp = dxpy.api.record_new(dx_hash, **kwargs)
self.set_ids(resp["id"], dx_hash["project"]) | python | def _new(self, dx_hash, close=False, **kwargs):
"""
:param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
:type dx_hash: dict
:param init_from: Record from which to initialize the metadata
:type init_from: :class:`DXRecord`
:param close: Whether or not to close the record immediately after creating it
:type close: boolean
Create a new remote record object.
"""
if "init_from" in kwargs:
if kwargs["init_from"] is not None:
if not isinstance(kwargs["init_from"], DXRecord):
raise DXError("Expected instance of DXRecord to init_from")
dx_hash["initializeFrom"] = \
{"id": kwargs["init_from"].get_id(),
"project": kwargs["init_from"].get_proj_id()}
del kwargs["init_from"]
if close:
dx_hash["close"] = True
resp = dxpy.api.record_new(dx_hash, **kwargs)
self.set_ids(resp["id"], dx_hash["project"]) | :param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
:type dx_hash: dict
:param init_from: Record from which to initialize the metadata
:type init_from: :class:`DXRecord`
:param close: Whether or not to close the record immediately after creating it
:type close: boolean
Create a new remote record object. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxrecord.py#L79-L105 |
dnanexus/dx-toolkit | src/python/dxpy/utils/executable_unbuilder.py | _recursive_cleanup | def _recursive_cleanup(foo):
"""
Aggressively cleans up things that look empty.
"""
if isinstance(foo, dict):
for (key, val) in list(foo.items()):
if isinstance(val, dict):
_recursive_cleanup(val)
if val == "" or val == [] or val == {}:
del foo[key] | python | def _recursive_cleanup(foo):
"""
Aggressively cleans up things that look empty.
"""
if isinstance(foo, dict):
for (key, val) in list(foo.items()):
if isinstance(val, dict):
_recursive_cleanup(val)
if val == "" or val == [] or val == {}:
del foo[key] | Aggressively cleans up things that look empty. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/executable_unbuilder.py#L41-L50 |
dnanexus/dx-toolkit | src/python/dxpy/utils/executable_unbuilder.py | dump_executable | def dump_executable(executable, destination_directory, omit_resources=False, describe_output={}):
"""
Reconstitutes an app, applet, or a workflow into a directory that would
create a functionally identical executable if "dx build" were run on it.
destination_directory will be the root source directory for the
executable.
:param executable: executable, i.e. app, applet, or workflow, to be dumped
:type executable: DXExecutable (either of: DXApp, DXApplet, DXWorkflow, DXGlobalWorkflow)
:param destination_directory: an existing, empty, and writable directory
:type destination_directory: str
:param omit_resources: if True, executable's resources will not be downloaded
:type omit_resources: boolean
:param describe_output: output of a describe API call on the executable
:type describe_output: dictionary
"""
try:
old_cwd = os.getcwd()
os.chdir(destination_directory)
if isinstance(executable, dxpy.DXWorkflow):
_dump_workflow(executable, describe_output)
elif isinstance(executable, dxpy.DXGlobalWorkflow):
# Add inputs, outputs, stages. These fields contain region-specific values
# e.g. files or applets, that's why:
# * if the workflow is global, we will unpack the underlying workflow
# from the region of the current project context
# * if this is a regular, project-based workflow, we will just use
# its description (the describe_output that we already have)
# Underlying workflows are workflows stored in resource containers
# of the global workflow (one per each region the global workflow is
# enabled in). #TODO: add a link to documentation.
current_project = dxpy.WORKSPACE_ID
if not current_project:
raise DXError(
'A project needs to be selected to "dx get" a global workflow. You can use "dx select" to select a project')
region = dxpy.api.project_describe(current_project,
input_params={"fields": {"region": True}})["region"]
describe_output = executable.append_underlying_workflow_desc(describe_output, region)
_dump_workflow(executable, describe_output)
else:
_dump_app_or_applet(executable, omit_resources, describe_output)
except:
err_exit()
finally:
os.chdir(old_cwd) | python | def dump_executable(executable, destination_directory, omit_resources=False, describe_output={}):
"""
Reconstitutes an app, applet, or a workflow into a directory that would
create a functionally identical executable if "dx build" were run on it.
destination_directory will be the root source directory for the
executable.
:param executable: executable, i.e. app, applet, or workflow, to be dumped
:type executable: DXExecutable (either of: DXApp, DXApplet, DXWorkflow, DXGlobalWorkflow)
:param destination_directory: an existing, empty, and writable directory
:type destination_directory: str
:param omit_resources: if True, executable's resources will not be downloaded
:type omit_resources: boolean
:param describe_output: output of a describe API call on the executable
:type describe_output: dictionary
"""
try:
old_cwd = os.getcwd()
os.chdir(destination_directory)
if isinstance(executable, dxpy.DXWorkflow):
_dump_workflow(executable, describe_output)
elif isinstance(executable, dxpy.DXGlobalWorkflow):
# Add inputs, outputs, stages. These fields contain region-specific values
# e.g. files or applets, that's why:
# * if the workflow is global, we will unpack the underlying workflow
# from the region of the current project context
# * if this is a regular, project-based workflow, we will just use
# its description (the describe_output that we already have)
# Underlying workflows are workflows stored in resource containers
# of the global workflow (one per each region the global workflow is
# enabled in). #TODO: add a link to documentation.
current_project = dxpy.WORKSPACE_ID
if not current_project:
raise DXError(
'A project needs to be selected to "dx get" a global workflow. You can use "dx select" to select a project')
region = dxpy.api.project_describe(current_project,
input_params={"fields": {"region": True}})["region"]
describe_output = executable.append_underlying_workflow_desc(describe_output, region)
_dump_workflow(executable, describe_output)
else:
_dump_app_or_applet(executable, omit_resources, describe_output)
except:
err_exit()
finally:
os.chdir(old_cwd) | Reconstitutes an app, applet, or a workflow into a directory that would
create a functionally identical executable if "dx build" were run on it.
destination_directory will be the root source directory for the
executable.
:param executable: executable, i.e. app, applet, or workflow, to be dumped
:type executable: DXExecutable (either of: DXApp, DXApplet, DXWorkflow, DXGlobalWorkflow)
:param destination_directory: an existing, empty, and writable directory
:type destination_directory: str
:param omit_resources: if True, executable's resources will not be downloaded
:type omit_resources: boolean
:param describe_output: output of a describe API call on the executable
:type describe_output: dictionary | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/executable_unbuilder.py#L310-L354 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | resolve_data_objects | def resolve_data_objects(objects, project=None, folder=None, batchsize=1000):
"""
:param objects: Data object specifications, each with fields "name"
(required), "folder", and "project"
:type objects: list of dictionaries
:param project: ID of project context; a data object's project defaults
to this if not specified for that object
:type project: string
:param folder: Folder path within the project; a data object's folder
path defaults to this if not specified for that object
:type folder: string
:param batchsize: Number of objects to resolve in each batch call to
system_resolve_data_objects; defaults to 1000 and is
only used for testing (must be a positive integer not
exceeding 1000)
:type batchsize: int
:returns: List of results parallel to input objects, where each
entry is a list containing 0 or more dicts, each corresponding
to a resolved object
:rtype: List of lists of dictionaries
Each returned element is a list of dictionaries with keys "project" and
"id". The number of dictionaries for each element may be 0, 1, or more.
"""
if not isinstance(batchsize, int) or batchsize <= 0 or batchsize > 1000:
raise ValueError("batchsize for resolve_data_objects must be a positive integer not exceeding 1000")
args = {}
if project:
args.update({'project': project})
if folder:
args.update({'folder': folder})
results = []
# Call API method /system/resolveDataObjects in groups of size batchsize
for i in range(0, len(objects), batchsize):
args.update({'objects': objects[i:(i+batchsize)]})
results.extend(dxpy.api.system_resolve_data_objects(args)['results'])
return results | python | def resolve_data_objects(objects, project=None, folder=None, batchsize=1000):
"""
:param objects: Data object specifications, each with fields "name"
(required), "folder", and "project"
:type objects: list of dictionaries
:param project: ID of project context; a data object's project defaults
to this if not specified for that object
:type project: string
:param folder: Folder path within the project; a data object's folder
path defaults to this if not specified for that object
:type folder: string
:param batchsize: Number of objects to resolve in each batch call to
system_resolve_data_objects; defaults to 1000 and is
only used for testing (must be a positive integer not
exceeding 1000)
:type batchsize: int
:returns: List of results parallel to input objects, where each
entry is a list containing 0 or more dicts, each corresponding
to a resolved object
:rtype: List of lists of dictionaries
Each returned element is a list of dictionaries with keys "project" and
"id". The number of dictionaries for each element may be 0, 1, or more.
"""
if not isinstance(batchsize, int) or batchsize <= 0 or batchsize > 1000:
raise ValueError("batchsize for resolve_data_objects must be a positive integer not exceeding 1000")
args = {}
if project:
args.update({'project': project})
if folder:
args.update({'folder': folder})
results = []
# Call API method /system/resolveDataObjects in groups of size batchsize
for i in range(0, len(objects), batchsize):
args.update({'objects': objects[i:(i+batchsize)]})
results.extend(dxpy.api.system_resolve_data_objects(args)['results'])
return results | :param objects: Data object specifications, each with fields "name"
(required), "folder", and "project"
:type objects: list of dictionaries
:param project: ID of project context; a data object's project defaults
to this if not specified for that object
:type project: string
:param folder: Folder path within the project; a data object's folder
path defaults to this if not specified for that object
:type folder: string
:param batchsize: Number of objects to resolve in each batch call to
system_resolve_data_objects; defaults to 1000 and is
only used for testing (must be a positive integer not
exceeding 1000)
:type batchsize: int
:returns: List of results parallel to input objects, where each
entry is a list containing 0 or more dicts, each corresponding
to a resolved object
:rtype: List of lists of dictionaries
Each returned element is a list of dictionaries with keys "project" and
"id". The number of dictionaries for each element may be 0, 1, or more. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L32-L70 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | _find | def _find(api_method, query, limit, return_handler, first_page_size, **kwargs):
''' Takes an API method handler (dxpy.api.find*) and calls it with *query*,
and then wraps a generator around its output. Used by the methods below.
Note that this function may only be used for /system/find* methods.
'''
num_results = 0
if "limit" not in query:
query["limit"] = first_page_size
while True:
resp = api_method(query, **kwargs)
by_parent = resp.get('byParent')
descriptions = resp.get('describe')
def format_result(result):
if return_handler:
result = dxpy.get_handler(result['id'], project=result.get('project'))
if by_parent is not None:
return result, by_parent, descriptions
else:
return result
for i in resp["results"]:
if num_results == limit:
return
num_results += 1
yield format_result(i)
# set up next query
if resp["next"] is not None:
query["starting"] = resp["next"]
query["limit"] = min(query["limit"]*2, 1000)
else:
return | python | def _find(api_method, query, limit, return_handler, first_page_size, **kwargs):
''' Takes an API method handler (dxpy.api.find*) and calls it with *query*,
and then wraps a generator around its output. Used by the methods below.
Note that this function may only be used for /system/find* methods.
'''
num_results = 0
if "limit" not in query:
query["limit"] = first_page_size
while True:
resp = api_method(query, **kwargs)
by_parent = resp.get('byParent')
descriptions = resp.get('describe')
def format_result(result):
if return_handler:
result = dxpy.get_handler(result['id'], project=result.get('project'))
if by_parent is not None:
return result, by_parent, descriptions
else:
return result
for i in resp["results"]:
if num_results == limit:
return
num_results += 1
yield format_result(i)
# set up next query
if resp["next"] is not None:
query["starting"] = resp["next"]
query["limit"] = min(query["limit"]*2, 1000)
else:
return | Takes an API method handler (dxpy.api.find*) and calls it with *query*,
and then wraps a generator around its output. Used by the methods below.
Note that this function may only be used for /system/find* methods. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L73-L108 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_data_objects | def find_data_objects(classname=None, state=None, visibility=None,
name=None, name_mode='exact', properties=None,
typename=None, tag=None, tags=None,
link=None, project=None, folder=None, recurse=None,
modified_after=None, modified_before=None,
created_after=None, created_before=None,
describe=False, limit=None, level=None, region=None,
return_handler=False, first_page_size=100,
**kwargs):
"""
:param classname:
Class with which to restrict the search, i.e. one of "record",
"file", "applet", "workflow"
:type classname: string
:param state: State of the object ("open", "closing", "closed", "any")
:type state: string
:param visibility: Visibility of the object ("hidden", "visible", "either")
:type visibility: string
:param name: Name of the object (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param typename: Type constraint that each result must conform to
:type typename: string or dict
:param tag: Tag that each result must be tagged with (deprecated in favor of *tags*)
:type tag: string
:param tags: List of tags that each result must have ALL of
:type tags: list of strings
:param link: ID of an object that each result must link to
:type link: string
:param project: ID of a project in which each result must appear
:type project: string
:param folder: If *project* is given, full path to a folder in which each result must belong (default is the root folder)
:type folder: string
:param recurse: If *project* is given, whether to look in subfolders of *folder* as well (default is True)
:type recurse: boolean
:param modified_after: Timestamp after which each result was last modified (see note below for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note below for interpretation)
:type modified_before: int or string
:param created_after: Timestamp after which each result was last created (see note below for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note below for interpretation)
:type created_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each object. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may, among other
things, be used to customize the set of fields that is returned)
:type describe: bool or dict
:param level: The minimum permissions level for which results should be returned (one of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINISTER")
:param region: Filter on result set by the given region(s).
:type region: string or list of strings
:type level: string
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all data objects matching the query,
up to *limit* objects. It transparently handles paging through the
result set if necessary. For all parameters that are omitted, the
search is not restricted by the corresponding field.
.. note:: All timestamps must be supplied as one of the following:
* A nonnegative integer, interpreted as milliseconds since the Epoch
* A negative integer, interpreted as an offset in milliseconds relative
to the current time
* A string containing a negative integer with one of the suffixes
"s", "m", "d", "w", or "y" (for seconds, minutes, days, weeks,
or years), interpreted as an offset from the current time.
The following examples both find all items that were created more
than 1 week ago::
items1 = list(find_data_objects(created_before="-1w"))
items2 = list(find_data_objects(created_before=-7*24*60*60*1000))
This example iterates through all files with property
"project" set to "cancer project" and prints their object IDs:
for result in find_data_objects(classname="file", properties={"project": "cancer project"}):
print "Found a file with object id " + result["id"]
"""
query = {}
if classname is not None:
query["class"] = classname
if state is not None:
query["state"] = state
if visibility is not None:
query["visibility"] = visibility
if name is not None:
if name_mode == 'exact':
query["name"] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_data_objects: Unexpected value found for argument name_mode')
if properties is not None:
query["properties"] = properties
if typename is not None:
query["type"] = typename
if tag is not None and tags is not None:
raise DXError('find_data_objects: Arguments "tag" and "tags" cannot both be provided')
if tag is not None:
query["tag"] = tag
if tags is not None:
query["tags"] = {"$and": tags}
if link is not None:
query["link"] = link
if project is not None:
query["scope"] = {"project": project}
if folder is not None:
query["scope"]["folder"] = folder
if recurse is not None:
query["scope"]["recurse"] = recurse
elif folder is not None or recurse is not None:
if dxpy.WORKSPACE_ID is not None:
query['scope'] = {'project': dxpy.WORKSPACE_ID}
if folder is not None:
query['scope']['folder'] = folder
if recurse is not None:
query['scope']['recurse'] = recurse
else:
raise DXError("Cannot search within a folder or recurse if a project is not specified")
if modified_after is not None or modified_before is not None:
query["modified"] = {}
if modified_after is not None:
query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
if modified_before is not None:
query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if level is not None:
query['level'] = level
if region is not None:
query['region'] = region
if limit is not None:
query["limit"] = limit
return _find(dxpy.api.system_find_data_objects, query, limit, return_handler, first_page_size, **kwargs) | python | def find_data_objects(classname=None, state=None, visibility=None,
name=None, name_mode='exact', properties=None,
typename=None, tag=None, tags=None,
link=None, project=None, folder=None, recurse=None,
modified_after=None, modified_before=None,
created_after=None, created_before=None,
describe=False, limit=None, level=None, region=None,
return_handler=False, first_page_size=100,
**kwargs):
"""
:param classname:
Class with which to restrict the search, i.e. one of "record",
"file", "applet", "workflow"
:type classname: string
:param state: State of the object ("open", "closing", "closed", "any")
:type state: string
:param visibility: Visibility of the object ("hidden", "visible", "either")
:type visibility: string
:param name: Name of the object (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param typename: Type constraint that each result must conform to
:type typename: string or dict
:param tag: Tag that each result must be tagged with (deprecated in favor of *tags*)
:type tag: string
:param tags: List of tags that each result must have ALL of
:type tags: list of strings
:param link: ID of an object that each result must link to
:type link: string
:param project: ID of a project in which each result must appear
:type project: string
:param folder: If *project* is given, full path to a folder in which each result must belong (default is the root folder)
:type folder: string
:param recurse: If *project* is given, whether to look in subfolders of *folder* as well (default is True)
:type recurse: boolean
:param modified_after: Timestamp after which each result was last modified (see note below for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note below for interpretation)
:type modified_before: int or string
:param created_after: Timestamp after which each result was last created (see note below for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note below for interpretation)
:type created_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each object. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may, among other
things, be used to customize the set of fields that is returned)
:type describe: bool or dict
:param level: The minimum permissions level for which results should be returned (one of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINISTER")
:param region: Filter on result set by the given region(s).
:type region: string or list of strings
:type level: string
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all data objects matching the query,
up to *limit* objects. It transparently handles paging through the
result set if necessary. For all parameters that are omitted, the
search is not restricted by the corresponding field.
.. note:: All timestamps must be supplied as one of the following:
* A nonnegative integer, interpreted as milliseconds since the Epoch
* A negative integer, interpreted as an offset in milliseconds relative
to the current time
* A string containing a negative integer with one of the suffixes
"s", "m", "d", "w", or "y" (for seconds, minutes, days, weeks,
or years), interpreted as an offset from the current time.
The following examples both find all items that were created more
than 1 week ago::
items1 = list(find_data_objects(created_before="-1w"))
items2 = list(find_data_objects(created_before=-7*24*60*60*1000))
This example iterates through all files with property
"project" set to "cancer project" and prints their object IDs:
for result in find_data_objects(classname="file", properties={"project": "cancer project"}):
print "Found a file with object id " + result["id"]
"""
query = {}
if classname is not None:
query["class"] = classname
if state is not None:
query["state"] = state
if visibility is not None:
query["visibility"] = visibility
if name is not None:
if name_mode == 'exact':
query["name"] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_data_objects: Unexpected value found for argument name_mode')
if properties is not None:
query["properties"] = properties
if typename is not None:
query["type"] = typename
if tag is not None and tags is not None:
raise DXError('find_data_objects: Arguments "tag" and "tags" cannot both be provided')
if tag is not None:
query["tag"] = tag
if tags is not None:
query["tags"] = {"$and": tags}
if link is not None:
query["link"] = link
if project is not None:
query["scope"] = {"project": project}
if folder is not None:
query["scope"]["folder"] = folder
if recurse is not None:
query["scope"]["recurse"] = recurse
elif folder is not None or recurse is not None:
if dxpy.WORKSPACE_ID is not None:
query['scope'] = {'project': dxpy.WORKSPACE_ID}
if folder is not None:
query['scope']['folder'] = folder
if recurse is not None:
query['scope']['recurse'] = recurse
else:
raise DXError("Cannot search within a folder or recurse if a project is not specified")
if modified_after is not None or modified_before is not None:
query["modified"] = {}
if modified_after is not None:
query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
if modified_before is not None:
query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if level is not None:
query['level'] = level
if region is not None:
query['region'] = region
if limit is not None:
query["limit"] = limit
return _find(dxpy.api.system_find_data_objects, query, limit, return_handler, first_page_size, **kwargs) | :param classname:
Class with which to restrict the search, i.e. one of "record",
"file", "applet", "workflow"
:type classname: string
:param state: State of the object ("open", "closing", "closed", "any")
:type state: string
:param visibility: Visibility of the object ("hidden", "visible", "either")
:type visibility: string
:param name: Name of the object (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param typename: Type constraint that each result must conform to
:type typename: string or dict
:param tag: Tag that each result must be tagged with (deprecated in favor of *tags*)
:type tag: string
:param tags: List of tags that each result must have ALL of
:type tags: list of strings
:param link: ID of an object that each result must link to
:type link: string
:param project: ID of a project in which each result must appear
:type project: string
:param folder: If *project* is given, full path to a folder in which each result must belong (default is the root folder)
:type folder: string
:param recurse: If *project* is given, whether to look in subfolders of *folder* as well (default is True)
:type recurse: boolean
:param modified_after: Timestamp after which each result was last modified (see note below for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note below for interpretation)
:type modified_before: int or string
:param created_after: Timestamp after which each result was last created (see note below for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note below for interpretation)
:type created_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each object. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may, among other
things, be used to customize the set of fields that is returned)
:type describe: bool or dict
:param level: The minimum permissions level for which results should be returned (one of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINISTER")
:param region: Filter on result set by the given region(s).
:type region: string or list of strings
:type level: string
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all data objects matching the query,
up to *limit* objects. It transparently handles paging through the
result set if necessary. For all parameters that are omitted, the
search is not restricted by the corresponding field.
.. note:: All timestamps must be supplied as one of the following:
* A nonnegative integer, interpreted as milliseconds since the Epoch
* A negative integer, interpreted as an offset in milliseconds relative
to the current time
* A string containing a negative integer with one of the suffixes
"s", "m", "d", "w", or "y" (for seconds, minutes, days, weeks,
or years), interpreted as an offset from the current time.
The following examples both find all items that were created more
than 1 week ago::
items1 = list(find_data_objects(created_before="-1w"))
items2 = list(find_data_objects(created_before=-7*24*60*60*1000))
This example iterates through all files with property
"project" set to "cancer project" and prints their object IDs:
for result in find_data_objects(classname="file", properties={"project": "cancer project"}):
print "Found a file with object id " + result["id"] | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L110-L266 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_executions | def find_executions(classname=None, launched_by=None, executable=None, project=None,
state=None, origin_job=None, parent_job=None, no_parent_job=False,
parent_analysis=None, no_parent_analysis=False, root_execution=None,
created_after=None, created_before=None, describe=False,
name=None, name_mode="exact", tags=None, properties=None, limit=None,
first_page_size=100, return_handler=False, include_subjobs=True,
**kwargs):
'''
:param classname:
Class with which to restrict the search, i.e. one of "job",
"analysis"
:type classname: string
:param launched_by: User ID of the user who launched the execution's origin execution
:type launched_by: string
:param executable: ID of the applet or app that spawned this execution, or a corresponding remote object handler
:type executable: string or a DXApp/DXApplet/DXWorkflow instance
:param project: ID of the project context for the execution
:type project: string
:param state: State of the execution (e.g. "failed", "done")
:type state: string
:param origin_job: ID of the original job that eventually spawned this execution (possibly by way of other executions)
:type origin_job: string
:param parent_job: ID of the parent job (deprecated: use the string 'none' to indicate it should have no parent job; use *no_parent_job* instead)
:type parent_job: string
:param no_parent_job: Indicate results should have no parent job; cannot be set to True with *parent_job* set to a string
:type no_parent_job: boolean
:param parent_analysis: ID of the parent analysis (deprecated: use the string 'none' to indicate it should have no parent analysis; use *no_parent_analysis* instead)
:type parent_analysis: string
:param no_parent_analysis: Indicate results should have no parent analysis; cannot be set to True with *parent_analysis* set to a string
:type no_parent_job: boolean
:param root_execution: ID of the top-level (user-initiated) execution (job or analysis) that eventually spawned this execution (possibly by way of other executions)
:type root_execution: string
:param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each execution. Supply False to omit
describe output, True to obtain the default describe output, or
a dict to be supplied as the describe call input (which may be
used to customize the set of fields that is to be returned; for
example, you can supply {"io": False} to suppress detailed
information about the execution's inputs and outputs)
:type describe: bool or dict
:param name: Name of the job or analysis to search by (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param tags: List of tags that each result must have ALL of
:type tags: list of strings
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:param include_subjobs: If False, no subjobs will be returned by the API
:type include_subjobs: boolean
:rtype: generator
Returns a generator that yields all executions (jobs or analyses) that match the query. It transparently handles
paging through the result set if necessary. For all parameters that are omitted, the search is not restricted by
the corresponding field.
The following example iterates through all finished jobs and analyses in a
particular project that were launched in the last two days::
for result in find_executions(state="done", project=proj_id, created_after="-2d"):
print "Found job or analysis with object id " + result["id"]
'''
query = {}
if classname is not None:
query["class"] = classname
if launched_by is not None:
query["launchedBy"] = launched_by
if executable is not None:
if isinstance(executable, (DXApplet, DXApp, DXWorkflow)):
query["executable"] = executable.get_id()
else:
query["executable"] = executable
if project is not None:
if isinstance(project, DXProject):
query["project"] = project.get_id()
else:
query["project"] = project
if state is not None:
query["state"] = state
if origin_job is not None:
if isinstance(origin_job, DXJob):
query["originJob"] = origin_job.get_id()
else:
query["originJob"] = origin_job
if parent_job is not None:
if no_parent_job:
raise DXError('find_executions: Cannot provide parent_job and set no_parent_job to True')
if parent_job == "none": # to be deprecated
query["parentJob"] = None
elif isinstance(parent_job, DXJob):
query["parentJob"] = parent_job.get_id()
else:
query["parentJob"] = parent_job
elif no_parent_job:
query["parentJob"] = None
if parent_analysis is not None:
if no_parent_analysis:
raise DXError('find_executions: Cannot provide parent_analysis and set no_parent_analysis to True')
if parent_analysis == "none": # to be deprecated
query["parentAnalysis"] = None
elif isinstance(parent_analysis, DXAnalysis):
query["parentAnalysis"] = parent_analysis.get_id()
else:
query["parentAnalysis"] = parent_analysis
elif no_parent_analysis:
query["parentAnalysis"] = None
if root_execution is not None:
if isinstance(root_execution, (DXJob, DXAnalysis)):
query["rootExecution"] = root_execution.get_id()
else:
query["rootExecution"] = root_execution
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_executions: Unexpected value found for argument name_mode')
if tags is not None:
query['tags'] = {'$and': tags}
if properties is not None:
query['properties'] = properties
if include_subjobs is not True:
query["includeSubjobs"] = include_subjobs
if limit is not None:
query["limit"] = limit
return _find(dxpy.api.system_find_executions, query, limit, return_handler, first_page_size, **kwargs) | python | def find_executions(classname=None, launched_by=None, executable=None, project=None,
state=None, origin_job=None, parent_job=None, no_parent_job=False,
parent_analysis=None, no_parent_analysis=False, root_execution=None,
created_after=None, created_before=None, describe=False,
name=None, name_mode="exact", tags=None, properties=None, limit=None,
first_page_size=100, return_handler=False, include_subjobs=True,
**kwargs):
'''
:param classname:
Class with which to restrict the search, i.e. one of "job",
"analysis"
:type classname: string
:param launched_by: User ID of the user who launched the execution's origin execution
:type launched_by: string
:param executable: ID of the applet or app that spawned this execution, or a corresponding remote object handler
:type executable: string or a DXApp/DXApplet/DXWorkflow instance
:param project: ID of the project context for the execution
:type project: string
:param state: State of the execution (e.g. "failed", "done")
:type state: string
:param origin_job: ID of the original job that eventually spawned this execution (possibly by way of other executions)
:type origin_job: string
:param parent_job: ID of the parent job (deprecated: use the string 'none' to indicate it should have no parent job; use *no_parent_job* instead)
:type parent_job: string
:param no_parent_job: Indicate results should have no parent job; cannot be set to True with *parent_job* set to a string
:type no_parent_job: boolean
:param parent_analysis: ID of the parent analysis (deprecated: use the string 'none' to indicate it should have no parent analysis; use *no_parent_analysis* instead)
:type parent_analysis: string
:param no_parent_analysis: Indicate results should have no parent analysis; cannot be set to True with *parent_analysis* set to a string
:type no_parent_job: boolean
:param root_execution: ID of the top-level (user-initiated) execution (job or analysis) that eventually spawned this execution (possibly by way of other executions)
:type root_execution: string
:param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each execution. Supply False to omit
describe output, True to obtain the default describe output, or
a dict to be supplied as the describe call input (which may be
used to customize the set of fields that is to be returned; for
example, you can supply {"io": False} to suppress detailed
information about the execution's inputs and outputs)
:type describe: bool or dict
:param name: Name of the job or analysis to search by (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param tags: List of tags that each result must have ALL of
:type tags: list of strings
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:param include_subjobs: If False, no subjobs will be returned by the API
:type include_subjobs: boolean
:rtype: generator
Returns a generator that yields all executions (jobs or analyses) that match the query. It transparently handles
paging through the result set if necessary. For all parameters that are omitted, the search is not restricted by
the corresponding field.
The following example iterates through all finished jobs and analyses in a
particular project that were launched in the last two days::
for result in find_executions(state="done", project=proj_id, created_after="-2d"):
print "Found job or analysis with object id " + result["id"]
'''
query = {}
if classname is not None:
query["class"] = classname
if launched_by is not None:
query["launchedBy"] = launched_by
if executable is not None:
if isinstance(executable, (DXApplet, DXApp, DXWorkflow)):
query["executable"] = executable.get_id()
else:
query["executable"] = executable
if project is not None:
if isinstance(project, DXProject):
query["project"] = project.get_id()
else:
query["project"] = project
if state is not None:
query["state"] = state
if origin_job is not None:
if isinstance(origin_job, DXJob):
query["originJob"] = origin_job.get_id()
else:
query["originJob"] = origin_job
if parent_job is not None:
if no_parent_job:
raise DXError('find_executions: Cannot provide parent_job and set no_parent_job to True')
if parent_job == "none": # to be deprecated
query["parentJob"] = None
elif isinstance(parent_job, DXJob):
query["parentJob"] = parent_job.get_id()
else:
query["parentJob"] = parent_job
elif no_parent_job:
query["parentJob"] = None
if parent_analysis is not None:
if no_parent_analysis:
raise DXError('find_executions: Cannot provide parent_analysis and set no_parent_analysis to True')
if parent_analysis == "none": # to be deprecated
query["parentAnalysis"] = None
elif isinstance(parent_analysis, DXAnalysis):
query["parentAnalysis"] = parent_analysis.get_id()
else:
query["parentAnalysis"] = parent_analysis
elif no_parent_analysis:
query["parentAnalysis"] = None
if root_execution is not None:
if isinstance(root_execution, (DXJob, DXAnalysis)):
query["rootExecution"] = root_execution.get_id()
else:
query["rootExecution"] = root_execution
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_executions: Unexpected value found for argument name_mode')
if tags is not None:
query['tags'] = {'$and': tags}
if properties is not None:
query['properties'] = properties
if include_subjobs is not True:
query["includeSubjobs"] = include_subjobs
if limit is not None:
query["limit"] = limit
return _find(dxpy.api.system_find_executions, query, limit, return_handler, first_page_size, **kwargs) | :param classname:
Class with which to restrict the search, i.e. one of "job",
"analysis"
:type classname: string
:param launched_by: User ID of the user who launched the execution's origin execution
:type launched_by: string
:param executable: ID of the applet or app that spawned this execution, or a corresponding remote object handler
:type executable: string or a DXApp/DXApplet/DXWorkflow instance
:param project: ID of the project context for the execution
:type project: string
:param state: State of the execution (e.g. "failed", "done")
:type state: string
:param origin_job: ID of the original job that eventually spawned this execution (possibly by way of other executions)
:type origin_job: string
:param parent_job: ID of the parent job (deprecated: use the string 'none' to indicate it should have no parent job; use *no_parent_job* instead)
:type parent_job: string
:param no_parent_job: Indicate results should have no parent job; cannot be set to True with *parent_job* set to a string
:type no_parent_job: boolean
:param parent_analysis: ID of the parent analysis (deprecated: use the string 'none' to indicate it should have no parent analysis; use *no_parent_analysis* instead)
:type parent_analysis: string
:param no_parent_analysis: Indicate results should have no parent analysis; cannot be set to True with *parent_analysis* set to a string
:type no_parent_job: boolean
:param root_execution: ID of the top-level (user-initiated) execution (job or analysis) that eventually spawned this execution (possibly by way of other executions)
:type root_execution: string
:param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each execution. Supply False to omit
describe output, True to obtain the default describe output, or
a dict to be supplied as the describe call input (which may be
used to customize the set of fields that is to be returned; for
example, you can supply {"io": False} to suppress detailed
information about the execution's inputs and outputs)
:type describe: bool or dict
:param name: Name of the job or analysis to search by (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param tags: List of tags that each result must have ALL of
:type tags: list of strings
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:param include_subjobs: If False, no subjobs will be returned by the API
:type include_subjobs: boolean
:rtype: generator
Returns a generator that yields all executions (jobs or analyses) that match the query. It transparently handles
paging through the result set if necessary. For all parameters that are omitted, the search is not restricted by
the corresponding field.
The following example iterates through all finished jobs and analyses in a
particular project that were launched in the last two days::
for result in find_executions(state="done", project=proj_id, created_after="-2d"):
print "Found job or analysis with object id " + result["id"] | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L269-L418 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_projects | def find_projects(name=None, name_mode='exact', properties=None, tags=None,
level=None, describe=False, explicit_perms=None, region=None,
public=None, created_after=None, created_before=None, billed_to=None,
limit=None, return_handler=False, first_page_size=100, containsPHI=None, **kwargs):
"""
:param name: Name of the project (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param tags: Tags that each result must have
:type tags: list of strings
:param level: One of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINSTER". If specified, only returns projects where the current user has at least the specified permission level.
:type level: string
:param describe: Controls whether to also return the output of
calling describe() on each project. Supply False to omit
describe output, True to obtain the default describe output, or
a dict to be supplied as the describe call input (which may be
used to customize the set of fields that is returned)
:type describe: bool or dict
:param explicit_perms: Filter on presence of an explicit permision. If True, matching projects must have an explicit permission (any permission granted directly to the user or an organization to which the user belongs). If False, matching projects must not have any explicit permissions for the user. (default is None, for no filter)
:type explicit_perms: boolean or None
:param region: If specified, only returns projects where the project is in the given region.
:type region: string
:param public: Filter on the project being public. If True, matching projects must be public. If False, matching projects must not be public. (default is None, for no filter)
:type public: boolean or None
:param created_after: Timestamp after which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param billed_to: Entity ID (user or organization) that pays for the project's storage costs
:type billed_to: string
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:param containsPHI: If set to true, only returns projects that contain PHI.
If set to false, only returns projects that do not contain PHI.
:type containsPHI: boolean
:rtype: generator
Returns a generator that yields all projects that match the query.
It transparently handles paging through the result set if necessary.
For all parameters that are omitted, the search is not restricted by
the corresponding field.
You can use the *level* parameter to find projects that the user has
at least a specific level of access to (e.g. "CONTRIBUTE").
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_projects: Unexpected value found for argument name_mode')
if properties is not None:
query["properties"] = properties
if tags is not None:
query["tags"] = {"$and": tags}
if level is not None:
query["level"] = level
if describe is not None and describe is not False:
query["describe"] = describe
if explicit_perms is not None:
query['explicitPermission'] = explicit_perms
if public is not None:
query['public'] = public
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if region is not None:
query['region'] = region
if billed_to is not None:
query['billTo'] = billed_to
if limit is not None:
query["limit"] = limit
if containsPHI is not None:
query["containsPHI"] = containsPHI
return _find(dxpy.api.system_find_projects, query, limit, return_handler, first_page_size, **kwargs) | python | def find_projects(name=None, name_mode='exact', properties=None, tags=None,
level=None, describe=False, explicit_perms=None, region=None,
public=None, created_after=None, created_before=None, billed_to=None,
limit=None, return_handler=False, first_page_size=100, containsPHI=None, **kwargs):
"""
:param name: Name of the project (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param tags: Tags that each result must have
:type tags: list of strings
:param level: One of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINSTER". If specified, only returns projects where the current user has at least the specified permission level.
:type level: string
:param describe: Controls whether to also return the output of
calling describe() on each project. Supply False to omit
describe output, True to obtain the default describe output, or
a dict to be supplied as the describe call input (which may be
used to customize the set of fields that is returned)
:type describe: bool or dict
:param explicit_perms: Filter on presence of an explicit permision. If True, matching projects must have an explicit permission (any permission granted directly to the user or an organization to which the user belongs). If False, matching projects must not have any explicit permissions for the user. (default is None, for no filter)
:type explicit_perms: boolean or None
:param region: If specified, only returns projects where the project is in the given region.
:type region: string
:param public: Filter on the project being public. If True, matching projects must be public. If False, matching projects must not be public. (default is None, for no filter)
:type public: boolean or None
:param created_after: Timestamp after which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param billed_to: Entity ID (user or organization) that pays for the project's storage costs
:type billed_to: string
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:param containsPHI: If set to true, only returns projects that contain PHI.
If set to false, only returns projects that do not contain PHI.
:type containsPHI: boolean
:rtype: generator
Returns a generator that yields all projects that match the query.
It transparently handles paging through the result set if necessary.
For all parameters that are omitted, the search is not restricted by
the corresponding field.
You can use the *level* parameter to find projects that the user has
at least a specific level of access to (e.g. "CONTRIBUTE").
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_projects: Unexpected value found for argument name_mode')
if properties is not None:
query["properties"] = properties
if tags is not None:
query["tags"] = {"$and": tags}
if level is not None:
query["level"] = level
if describe is not None and describe is not False:
query["describe"] = describe
if explicit_perms is not None:
query['explicitPermission'] = explicit_perms
if public is not None:
query['public'] = public
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if region is not None:
query['region'] = region
if billed_to is not None:
query['billTo'] = billed_to
if limit is not None:
query["limit"] = limit
if containsPHI is not None:
query["containsPHI"] = containsPHI
return _find(dxpy.api.system_find_projects, query, limit, return_handler, first_page_size, **kwargs) | :param name: Name of the project (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param properties: Properties (key-value pairs) that each result must have (use value True to require the property key and allow any value)
:type properties: dict
:param tags: Tags that each result must have
:type tags: list of strings
:param level: One of "VIEW", "UPLOAD", "CONTRIBUTE", or "ADMINSTER". If specified, only returns projects where the current user has at least the specified permission level.
:type level: string
:param describe: Controls whether to also return the output of
calling describe() on each project. Supply False to omit
describe output, True to obtain the default describe output, or
a dict to be supplied as the describe call input (which may be
used to customize the set of fields that is returned)
:type describe: bool or dict
:param explicit_perms: Filter on presence of an explicit permision. If True, matching projects must have an explicit permission (any permission granted directly to the user or an organization to which the user belongs). If False, matching projects must not have any explicit permissions for the user. (default is None, for no filter)
:type explicit_perms: boolean or None
:param region: If specified, only returns projects where the project is in the given region.
:type region: string
:param public: Filter on the project being public. If True, matching projects must be public. If False, matching projects must not be public. (default is None, for no filter)
:type public: boolean or None
:param created_after: Timestamp after which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param billed_to: Entity ID (user or organization) that pays for the project's storage costs
:type billed_to: string
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:param containsPHI: If set to true, only returns projects that contain PHI.
If set to false, only returns projects that do not contain PHI.
:type containsPHI: boolean
:rtype: generator
Returns a generator that yields all projects that match the query.
It transparently handles paging through the result set if necessary.
For all parameters that are omitted, the search is not restricted by
the corresponding field.
You can use the *level* parameter to find projects that the user has
at least a specific level of access to (e.g. "CONTRIBUTE"). | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L434-L526 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_global_executables | def find_global_executables(method, name=None, name_mode='exact', category=None,
all_versions=None, published=None,
billed_to=None, created_by=None, developer=None,
created_after=None, created_before=None,
modified_after=None, modified_before=None,
describe=False, limit=None, return_handler=False,
first_page_size=100, **kwargs):
"""
:param method: Name of the API method used to find the global executable (app or a global workflow).
:type name: function
:param name: Name of the app or a global workflow (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param category: If specified, only returns executables that are in the specified category
:type category: string
:param all_versions: Whether to return all versions of each app/global workflow or just the version tagged "default"
:type all_versions: boolean
:param published: If specified, only returns results that have the specified publish status (True for published apps/global workflows, False for unpublished ones)
:type published: boolean
:param billed_to: Entity ID (user or organization) that pays for the storage costs of the app/global workflow
:type billed_to: string
:param created_by: If specified, only returns versions that were created by the specified user (of the form "user-USERNAME")
:type created_by: string
:param developer: If specified, only returns apps or global workflows for which the specified user (of the form "user-USERNAME") is a developer
:type developer: string
:param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param modified_after: Timestamp after which each result was last modified (see note accompanying :meth:`find_data_objects()` for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note accompanying :meth:`find_data_objects()` for interpretation)
:type modified_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each executable. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may be used to
customize the set of fields that is returned)
:type describe: bool or dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all global executables (either apps or
global workflows) that match the query. It transparently handles paging through
the result set if necessary. For all parameters that are omitted, the search is
not restricted by the corresponding field.
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_global_executables: Unexpected value found for argument name_mode')
if category is not None:
query["category"] = category
if all_versions is not None:
query["allVersions"] = all_versions
if published is not None:
query["published"] = published
if billed_to is not None:
query["billTo"] = billed_to
if created_by is not None:
query["createdBy"] = created_by
if developer is not None:
query["developer"] = developer
if modified_after is not None or modified_before is not None:
query["modified"] = {}
if modified_after is not None:
query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
if modified_before is not None:
query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if limit is not None:
query["limit"] = limit
return _find(method, query, limit, return_handler, first_page_size, **kwargs) | python | def find_global_executables(method, name=None, name_mode='exact', category=None,
all_versions=None, published=None,
billed_to=None, created_by=None, developer=None,
created_after=None, created_before=None,
modified_after=None, modified_before=None,
describe=False, limit=None, return_handler=False,
first_page_size=100, **kwargs):
"""
:param method: Name of the API method used to find the global executable (app or a global workflow).
:type name: function
:param name: Name of the app or a global workflow (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param category: If specified, only returns executables that are in the specified category
:type category: string
:param all_versions: Whether to return all versions of each app/global workflow or just the version tagged "default"
:type all_versions: boolean
:param published: If specified, only returns results that have the specified publish status (True for published apps/global workflows, False for unpublished ones)
:type published: boolean
:param billed_to: Entity ID (user or organization) that pays for the storage costs of the app/global workflow
:type billed_to: string
:param created_by: If specified, only returns versions that were created by the specified user (of the form "user-USERNAME")
:type created_by: string
:param developer: If specified, only returns apps or global workflows for which the specified user (of the form "user-USERNAME") is a developer
:type developer: string
:param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param modified_after: Timestamp after which each result was last modified (see note accompanying :meth:`find_data_objects()` for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note accompanying :meth:`find_data_objects()` for interpretation)
:type modified_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each executable. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may be used to
customize the set of fields that is returned)
:type describe: bool or dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all global executables (either apps or
global workflows) that match the query. It transparently handles paging through
the result set if necessary. For all parameters that are omitted, the search is
not restricted by the corresponding field.
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_global_executables: Unexpected value found for argument name_mode')
if category is not None:
query["category"] = category
if all_versions is not None:
query["allVersions"] = all_versions
if published is not None:
query["published"] = published
if billed_to is not None:
query["billTo"] = billed_to
if created_by is not None:
query["createdBy"] = created_by
if developer is not None:
query["developer"] = developer
if modified_after is not None or modified_before is not None:
query["modified"] = {}
if modified_after is not None:
query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
if modified_before is not None:
query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if limit is not None:
query["limit"] = limit
return _find(method, query, limit, return_handler, first_page_size, **kwargs) | :param method: Name of the API method used to find the global executable (app or a global workflow).
:type name: function
:param name: Name of the app or a global workflow (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param category: If specified, only returns executables that are in the specified category
:type category: string
:param all_versions: Whether to return all versions of each app/global workflow or just the version tagged "default"
:type all_versions: boolean
:param published: If specified, only returns results that have the specified publish status (True for published apps/global workflows, False for unpublished ones)
:type published: boolean
:param billed_to: Entity ID (user or organization) that pays for the storage costs of the app/global workflow
:type billed_to: string
:param created_by: If specified, only returns versions that were created by the specified user (of the form "user-USERNAME")
:type created_by: string
:param developer: If specified, only returns apps or global workflows for which the specified user (of the form "user-USERNAME") is a developer
:type developer: string
:param created_after: Timestamp after which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param modified_after: Timestamp after which each result was last modified (see note accompanying :meth:`find_data_objects()` for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note accompanying :meth:`find_data_objects()` for interpretation)
:type modified_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each executable. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may be used to
customize the set of fields that is returned)
:type describe: bool or dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all global executables (either apps or
global workflows) that match the query. It transparently handles paging through
the result set if necessary. For all parameters that are omitted, the search is
not restricted by the corresponding field. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L528-L622 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_apps | def find_apps(name=None, name_mode='exact', category=None,
all_versions=None, published=None,
billed_to=None, created_by=None, developer=None,
created_after=None, created_before=None,
modified_after=None, modified_before=None,
describe=False, limit=None, return_handler=False, first_page_size=100, **kwargs):
"""
This method is identical to :meth:`find_global_executables()` with the API method
used: :meth:`system_find_apps()`.
"""
return find_global_executables(dxpy.api.system_find_apps,
name=name, name_mode=name_mode, category=category,
all_versions=all_versions, published=published,
billed_to=billed_to, created_by=created_by, developer=developer,
created_after=created_after, created_before=created_before,
modified_after=modified_after, modified_before=modified_before,
describe=describe, limit=limit, return_handler=return_handler,
first_page_size=first_page_size, **kwargs) | python | def find_apps(name=None, name_mode='exact', category=None,
all_versions=None, published=None,
billed_to=None, created_by=None, developer=None,
created_after=None, created_before=None,
modified_after=None, modified_before=None,
describe=False, limit=None, return_handler=False, first_page_size=100, **kwargs):
"""
This method is identical to :meth:`find_global_executables()` with the API method
used: :meth:`system_find_apps()`.
"""
return find_global_executables(dxpy.api.system_find_apps,
name=name, name_mode=name_mode, category=category,
all_versions=all_versions, published=published,
billed_to=billed_to, created_by=created_by, developer=developer,
created_after=created_after, created_before=created_before,
modified_after=modified_after, modified_before=modified_before,
describe=describe, limit=limit, return_handler=return_handler,
first_page_size=first_page_size, **kwargs) | This method is identical to :meth:`find_global_executables()` with the API method
used: :meth:`system_find_apps()`. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L624-L641 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_one_data_object | def find_one_data_object(zero_ok=False, more_ok=True, **kwargs):
"""
:param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one data object that satisfies the supplied constraints, or
None if none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_data_objects()`.
"""
return _find_one(find_data_objects, zero_ok=zero_ok, more_ok=more_ok, **kwargs) | python | def find_one_data_object(zero_ok=False, more_ok=True, **kwargs):
"""
:param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one data object that satisfies the supplied constraints, or
None if none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_data_objects()`.
"""
return _find_one(find_data_objects, zero_ok=zero_ok, more_ok=more_ok, **kwargs) | :param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one data object that satisfies the supplied constraints, or
None if none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_data_objects()`. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L679-L696 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_one_project | def find_one_project(zero_ok=False, more_ok=True, **kwargs):
"""
:param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one project that satisfies the supplied constraints, or None
if none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_projects()`.
"""
return _find_one(find_projects, zero_ok=zero_ok, more_ok=more_ok, **kwargs) | python | def find_one_project(zero_ok=False, more_ok=True, **kwargs):
"""
:param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one project that satisfies the supplied constraints, or None
if none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_projects()`.
"""
return _find_one(find_projects, zero_ok=zero_ok, more_ok=more_ok, **kwargs) | :param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one project that satisfies the supplied constraints, or None
if none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_projects()`. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L699-L716 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_one_app | def find_one_app(zero_ok=False, more_ok=True, **kwargs):
"""
:param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one app that satisfies the supplied constraints, or None if
none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_apps()`.
"""
return _find_one(find_apps, zero_ok=zero_ok, more_ok=more_ok, **kwargs) | python | def find_one_app(zero_ok=False, more_ok=True, **kwargs):
"""
:param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one app that satisfies the supplied constraints, or None if
none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_apps()`.
"""
return _find_one(find_apps, zero_ok=zero_ok, more_ok=more_ok, **kwargs) | :param zero_ok:
If False (default), :class:`~dxpy.exceptions.DXSearchError` is
raised if the search has 0 results; if True, returns None if the
search has 0 results
:type zero_ok: bool
:param more_ok:
If False, :class:`~dxpy.exceptions.DXSearchError` is raised if
the search has 2 or more results
:type more_ok: bool
Returns one app that satisfies the supplied constraints, or None if
none exist (provided *zero_ok* is True). Supports all search
constraint arguments supported by :meth:`find_apps()`. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L719-L736 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | _org_find | def _org_find(api_method, org_id, query, first_page_size=100):
"""
Takes an API method handler ``dxpy.api.org_find...`` and calls it with
*org_id* and *query*, then wraps a generator around its output. Used by
:meth:`org_find_members` and :meth:`org_find_projects` below.
:param first_page_size: The number of results that the initial API call will return.
:type first_page_size: int
"""
if "limit" not in query:
query["limit"] = min(first_page_size, 1000)
while True:
resp = api_method(org_id, query)
for result in resp["results"]:
yield result
# set up next query
if resp["next"] is not None:
query["starting"] = resp["next"]
query["limit"] = min(query["limit"] * 2, 1000)
else:
break | python | def _org_find(api_method, org_id, query, first_page_size=100):
"""
Takes an API method handler ``dxpy.api.org_find...`` and calls it with
*org_id* and *query*, then wraps a generator around its output. Used by
:meth:`org_find_members` and :meth:`org_find_projects` below.
:param first_page_size: The number of results that the initial API call will return.
:type first_page_size: int
"""
if "limit" not in query:
query["limit"] = min(first_page_size, 1000)
while True:
resp = api_method(org_id, query)
for result in resp["results"]:
yield result
# set up next query
if resp["next"] is not None:
query["starting"] = resp["next"]
query["limit"] = min(query["limit"] * 2, 1000)
else:
break | Takes an API method handler ``dxpy.api.org_find...`` and calls it with
*org_id* and *query*, then wraps a generator around its output. Used by
:meth:`org_find_members` and :meth:`org_find_projects` below.
:param first_page_size: The number of results that the initial API call will return.
:type first_page_size: int | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L739-L762 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | org_find_members | def org_find_members(org_id=None, level=None, describe=False):
"""
:param org_id: ID of the organization
:type org_id: string
:param level: The membership level in the org that each member in the result set must have (one of "MEMBER" or
"ADMIN")
:type level: string
:param describe: Whether or not to return the response of ``dxpy.api.user_describe`` for each result. False omits
the describe response; True includes it; a dict will be used as the input to ``dxpy.api.user_describe`` (to
customize the desired set of fields in the describe response).
:type describe: bool or dict
Returns a generator that yields all org members that match the query formed by intersecting all specified
constraints. The search is not restricted by any parameters that were unspecified.
"""
query = {}
if level is not None:
query["level"] = level
query["describe"] = describe
return _org_find(dxpy.api.org_find_members, org_id, query) | python | def org_find_members(org_id=None, level=None, describe=False):
"""
:param org_id: ID of the organization
:type org_id: string
:param level: The membership level in the org that each member in the result set must have (one of "MEMBER" or
"ADMIN")
:type level: string
:param describe: Whether or not to return the response of ``dxpy.api.user_describe`` for each result. False omits
the describe response; True includes it; a dict will be used as the input to ``dxpy.api.user_describe`` (to
customize the desired set of fields in the describe response).
:type describe: bool or dict
Returns a generator that yields all org members that match the query formed by intersecting all specified
constraints. The search is not restricted by any parameters that were unspecified.
"""
query = {}
if level is not None:
query["level"] = level
query["describe"] = describe
return _org_find(dxpy.api.org_find_members, org_id, query) | :param org_id: ID of the organization
:type org_id: string
:param level: The membership level in the org that each member in the result set must have (one of "MEMBER" or
"ADMIN")
:type level: string
:param describe: Whether or not to return the response of ``dxpy.api.user_describe`` for each result. False omits
the describe response; True includes it; a dict will be used as the input to ``dxpy.api.user_describe`` (to
customize the desired set of fields in the describe response).
:type describe: bool or dict
Returns a generator that yields all org members that match the query formed by intersecting all specified
constraints. The search is not restricted by any parameters that were unspecified. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L765-L785 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | org_find_projects | def org_find_projects(org_id=None, name=None, name_mode='exact', ids=None, properties=None, tags=None, describe=False,
public=None, created_after=None, created_before=None, region=None, containsPHI=None):
"""
:param org_id: ID of the organization
:type org_id: string
:param name: Name that each result must have (also see *name_mode* param)
:type name: string
:param name_mode: Method by which to interpret the *name* param ("exact": exact match,
"glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param ids: List of project IDs. Each result must have a project ID that was specified in this list.
:type ids: array of strings
:param properties: Properties (key-value pairs) that each result must have
(use value True to require the property key and allow any value)
:type properties: dict
:param tags: Tags that each result must have
:type tags: list of strings
:param describe: Whether or not to return the response of ``dxpy.api.project_describe`` for each result. False
omits the describe response; True includes it; a dict will be used as the input to
``dxpy.api.project_describe`` (to customize the desired set of fields in the describe response).
:type describe: bool or dict
:param public: True indicates that each result must be public; False indicates that each result must be private;
None indicates that both public and private projects will be returned in the result set.
:type public: boolean or None
:param created_after: Timestamp after which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param region: If specified, only returns projects where the project is in the given region.
:type region: string
:param containsPHI: If set to true, only returns projects that contain PHI.
If set to false, only returns projects that do not contain PHI.
:type containsPHI: boolean
:rtype: generator
Returns a generator that yields all projects that match the query formed by intersecting all specified
constraints. The search is not restricted by any parameters that were unspecified.
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('org_find_projects: Unexpected value found for argument name_mode')
if ids is not None:
query["id"] = ids
if properties is not None:
if len(properties.keys()) == 1:
query["properties"] = properties
else:
query["properties"] = {"$and": [{k: v} for (k, v) in properties.iteritems()]}
if tags is not None:
if len(tags) == 1:
query["tags"] = tags[0]
else:
query["tags"] = {"$and": tags}
query["describe"] = describe
if public is not None:
query['public'] = public
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if region is not None:
query['region'] = region
if containsPHI is not None:
query["containsPHI"] = containsPHI
return _org_find(dxpy.api.org_find_projects, org_id, query) | python | def org_find_projects(org_id=None, name=None, name_mode='exact', ids=None, properties=None, tags=None, describe=False,
public=None, created_after=None, created_before=None, region=None, containsPHI=None):
"""
:param org_id: ID of the organization
:type org_id: string
:param name: Name that each result must have (also see *name_mode* param)
:type name: string
:param name_mode: Method by which to interpret the *name* param ("exact": exact match,
"glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param ids: List of project IDs. Each result must have a project ID that was specified in this list.
:type ids: array of strings
:param properties: Properties (key-value pairs) that each result must have
(use value True to require the property key and allow any value)
:type properties: dict
:param tags: Tags that each result must have
:type tags: list of strings
:param describe: Whether or not to return the response of ``dxpy.api.project_describe`` for each result. False
omits the describe response; True includes it; a dict will be used as the input to
``dxpy.api.project_describe`` (to customize the desired set of fields in the describe response).
:type describe: bool or dict
:param public: True indicates that each result must be public; False indicates that each result must be private;
None indicates that both public and private projects will be returned in the result set.
:type public: boolean or None
:param created_after: Timestamp after which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param region: If specified, only returns projects where the project is in the given region.
:type region: string
:param containsPHI: If set to true, only returns projects that contain PHI.
If set to false, only returns projects that do not contain PHI.
:type containsPHI: boolean
:rtype: generator
Returns a generator that yields all projects that match the query formed by intersecting all specified
constraints. The search is not restricted by any parameters that were unspecified.
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('org_find_projects: Unexpected value found for argument name_mode')
if ids is not None:
query["id"] = ids
if properties is not None:
if len(properties.keys()) == 1:
query["properties"] = properties
else:
query["properties"] = {"$and": [{k: v} for (k, v) in properties.iteritems()]}
if tags is not None:
if len(tags) == 1:
query["tags"] = tags[0]
else:
query["tags"] = {"$and": tags}
query["describe"] = describe
if public is not None:
query['public'] = public
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if region is not None:
query['region'] = region
if containsPHI is not None:
query["containsPHI"] = containsPHI
return _org_find(dxpy.api.org_find_projects, org_id, query) | :param org_id: ID of the organization
:type org_id: string
:param name: Name that each result must have (also see *name_mode* param)
:type name: string
:param name_mode: Method by which to interpret the *name* param ("exact": exact match,
"glob": use "*" and "?" as wildcards, "regexp": interpret as a regular expression)
:type name_mode: string
:param ids: List of project IDs. Each result must have a project ID that was specified in this list.
:type ids: array of strings
:param properties: Properties (key-value pairs) that each result must have
(use value True to require the property key and allow any value)
:type properties: dict
:param tags: Tags that each result must have
:type tags: list of strings
:param describe: Whether or not to return the response of ``dxpy.api.project_describe`` for each result. False
omits the describe response; True includes it; a dict will be used as the input to
``dxpy.api.project_describe`` (to customize the desired set of fields in the describe response).
:type describe: bool or dict
:param public: True indicates that each result must be public; False indicates that each result must be private;
None indicates that both public and private projects will be returned in the result set.
:type public: boolean or None
:param created_after: Timestamp after which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was created
(see note accompanying :meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param region: If specified, only returns projects where the project is in the given region.
:type region: string
:param containsPHI: If set to true, only returns projects that contain PHI.
If set to false, only returns projects that do not contain PHI.
:type containsPHI: boolean
:rtype: generator
Returns a generator that yields all projects that match the query formed by intersecting all specified
constraints. The search is not restricted by any parameters that were unspecified. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L788-L865 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | org_find_apps | def org_find_apps(org_id,
name=None,
name_mode='exact',
category=None,
all_versions=None,
published=None,
created_by=None,
developer=None,
authorized_user=None,
created_after=None,
created_before=None,
modified_after=None,
modified_before=None,
describe=False,
limit=None,
return_handler=False,
first_page_size=100,
**kwargs):
"""
:param name: Name of the app (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field
"exact": exact match,
"glob": use "*" and "?" as wildcards,
"regexp": interpret as a regular expression
:type name_mode: string
:param category: If specified, only returns apps that are in the specified category
:type category: string
:param all_versions: Whether to return all versions of each app or just the version tagged "default"
:type all_versions: boolean
:param published: If specified, only returns results that have the specified publish status
True for published apps,
False for unpublished apps
:type published: boolean
:param created_by: If specified, only returns app versions that were created by the specified user
(of the form "user-USERNAME")
:type created_by: string
:param developer: If specified, only returns apps for which the specified user (of the form "user-USERNAME")
is a developer
:type developer: string
:param authorized_user: If specified, only returns apps for which the specified user (either a user ID, org ID,
or the string "PUBLIC") appears in the app's list of authorized users
:type authorized_user: string
:param created_after: Timestamp after which each result was last created (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param modified_after: Timestamp after which each result was last modified (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type modified_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each app. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may be used to
customize the set of fields that is returned)
:type describe: bool or dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise
this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict
with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all apps that match the query. It
transparently handles paging through the result set if necessary.
For all parameters that are omitted, the search is not restricted by
the corresponding field.
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_apps: Unexpected value found for argument name_mode')
if category is not None:
query["category"] = category
if all_versions is not None:
query["allVersions"] = all_versions
if published is not None:
query["published"] = published
if created_by is not None:
query["createdBy"] = created_by
if developer is not None:
query["developer"] = developer
if authorized_user is not None:
query["authorizedUser"] = authorized_user
if modified_after is not None or modified_before is not None:
query["modified"] = {}
if modified_after is not None:
query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
if modified_before is not None:
query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if limit is not None:
query["limit"] = limit
return _org_find(dxpy.api.org_find_apps, org_id, query) | python | def org_find_apps(org_id,
name=None,
name_mode='exact',
category=None,
all_versions=None,
published=None,
created_by=None,
developer=None,
authorized_user=None,
created_after=None,
created_before=None,
modified_after=None,
modified_before=None,
describe=False,
limit=None,
return_handler=False,
first_page_size=100,
**kwargs):
"""
:param name: Name of the app (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field
"exact": exact match,
"glob": use "*" and "?" as wildcards,
"regexp": interpret as a regular expression
:type name_mode: string
:param category: If specified, only returns apps that are in the specified category
:type category: string
:param all_versions: Whether to return all versions of each app or just the version tagged "default"
:type all_versions: boolean
:param published: If specified, only returns results that have the specified publish status
True for published apps,
False for unpublished apps
:type published: boolean
:param created_by: If specified, only returns app versions that were created by the specified user
(of the form "user-USERNAME")
:type created_by: string
:param developer: If specified, only returns apps for which the specified user (of the form "user-USERNAME")
is a developer
:type developer: string
:param authorized_user: If specified, only returns apps for which the specified user (either a user ID, org ID,
or the string "PUBLIC") appears in the app's list of authorized users
:type authorized_user: string
:param created_after: Timestamp after which each result was last created (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param modified_after: Timestamp after which each result was last modified (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type modified_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each app. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may be used to
customize the set of fields that is returned)
:type describe: bool or dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise
this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict
with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all apps that match the query. It
transparently handles paging through the result set if necessary.
For all parameters that are omitted, the search is not restricted by
the corresponding field.
"""
query = {}
if name is not None:
if name_mode == 'exact':
query['name'] = name
elif name_mode == 'glob':
query['name'] = {'glob': name}
elif name_mode == 'regexp':
query['name'] = {'regexp': name}
else:
raise DXError('find_apps: Unexpected value found for argument name_mode')
if category is not None:
query["category"] = category
if all_versions is not None:
query["allVersions"] = all_versions
if published is not None:
query["published"] = published
if created_by is not None:
query["createdBy"] = created_by
if developer is not None:
query["developer"] = developer
if authorized_user is not None:
query["authorizedUser"] = authorized_user
if modified_after is not None or modified_before is not None:
query["modified"] = {}
if modified_after is not None:
query["modified"]["after"] = dxpy.utils.normalize_time_input(modified_after)
if modified_before is not None:
query["modified"]["before"] = dxpy.utils.normalize_time_input(modified_before)
if created_after is not None or created_before is not None:
query["created"] = {}
if created_after is not None:
query["created"]["after"] = dxpy.utils.normalize_time_input(created_after)
if created_before is not None:
query["created"]["before"] = dxpy.utils.normalize_time_input(created_before)
if describe is not None and describe is not False:
query["describe"] = describe
if limit is not None:
query["limit"] = limit
return _org_find(dxpy.api.org_find_apps, org_id, query) | :param name: Name of the app (also see *name_mode*)
:type name: string
:param name_mode: Method by which to interpret the *name* field
"exact": exact match,
"glob": use "*" and "?" as wildcards,
"regexp": interpret as a regular expression
:type name_mode: string
:param category: If specified, only returns apps that are in the specified category
:type category: string
:param all_versions: Whether to return all versions of each app or just the version tagged "default"
:type all_versions: boolean
:param published: If specified, only returns results that have the specified publish status
True for published apps,
False for unpublished apps
:type published: boolean
:param created_by: If specified, only returns app versions that were created by the specified user
(of the form "user-USERNAME")
:type created_by: string
:param developer: If specified, only returns apps for which the specified user (of the form "user-USERNAME")
is a developer
:type developer: string
:param authorized_user: If specified, only returns apps for which the specified user (either a user ID, org ID,
or the string "PUBLIC") appears in the app's list of authorized users
:type authorized_user: string
:param created_after: Timestamp after which each result was last created (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type created_after: int or string
:param created_before: Timestamp before which each result was last created (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type created_before: int or string
:param modified_after: Timestamp after which each result was last modified (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type modified_after: int or string
:param modified_before: Timestamp before which each result was last modified (see note accompanying
:meth:`find_data_objects()` for interpretation)
:type modified_before: int or string
:param describe: Controls whether to also return the output of
calling describe() on each app. Supply False to omit describe
output, True to obtain the default describe output, or a dict to
be supplied as the describe call input (which may be used to
customize the set of fields that is returned)
:type describe: bool or dict
:param limit: The maximum number of results to be returned (if not specified, the number of results is unlimited)
:type limit: int
:param first_page_size: The number of results that the initial API call will return. Subsequent calls will raise
this by multiplying by 2 up to a maximum of 1000.
:type first_page_size: int
:param return_handler: If True, yields results as dxpy object handlers (otherwise, yields each result as a dict
with keys "id" and "project")
:type return_handler: boolean
:rtype: generator
Returns a generator that yields all apps that match the query. It
transparently handles paging through the result set if necessary.
For all parameters that are omitted, the search is not restricted by
the corresponding field. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L868-L985 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/search.py | find_orgs | def find_orgs(query, first_page_size=10):
"""
:param query: The input to the /system/findOrgs API method.
:type query: dict
:param first_page_size: The number of results that the initial
/system/findOrgs API call will return; default 10, max 1000. Subsequent
calls will raise the number of returned results exponentially up to a
max of 1000.
:type first_page_size: int
:rtype: generator
Returns a generator that yields all orgs matching the specified query. Will
transparently handle pagination as necessary.
"""
return _find(dxpy.api.system_find_orgs, query, limit=None,
return_handler=False, first_page_size=first_page_size) | python | def find_orgs(query, first_page_size=10):
"""
:param query: The input to the /system/findOrgs API method.
:type query: dict
:param first_page_size: The number of results that the initial
/system/findOrgs API call will return; default 10, max 1000. Subsequent
calls will raise the number of returned results exponentially up to a
max of 1000.
:type first_page_size: int
:rtype: generator
Returns a generator that yields all orgs matching the specified query. Will
transparently handle pagination as necessary.
"""
return _find(dxpy.api.system_find_orgs, query, limit=None,
return_handler=False, first_page_size=first_page_size) | :param query: The input to the /system/findOrgs API method.
:type query: dict
:param first_page_size: The number of results that the initial
/system/findOrgs API call will return; default 10, max 1000. Subsequent
calls will raise the number of returned results exponentially up to a
max of 1000.
:type first_page_size: int
:rtype: generator
Returns a generator that yields all orgs matching the specified query. Will
transparently handle pagination as necessary. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L987-L1004 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/download_all_inputs.py | _create_dirs | def _create_dirs(idir, dirs):
'''
Create a set of directories, so we could store the input files.
For example, seq1 could be stored under:
/in/seq1/NC_001122.fasta
TODO: this call could fail, we need to report a reasonable error code
Note that we create a directory for every file array, even if
it has zero inputs.
'''
# create the <idir> itself
file_load_utils.ensure_dir(idir)
# create each subdir
for d in dirs:
file_load_utils.ensure_dir(os.path.join(idir, d)) | python | def _create_dirs(idir, dirs):
'''
Create a set of directories, so we could store the input files.
For example, seq1 could be stored under:
/in/seq1/NC_001122.fasta
TODO: this call could fail, we need to report a reasonable error code
Note that we create a directory for every file array, even if
it has zero inputs.
'''
# create the <idir> itself
file_load_utils.ensure_dir(idir)
# create each subdir
for d in dirs:
file_load_utils.ensure_dir(os.path.join(idir, d)) | Create a set of directories, so we could store the input files.
For example, seq1 could be stored under:
/in/seq1/NC_001122.fasta
TODO: this call could fail, we need to report a reasonable error code
Note that we create a directory for every file array, even if
it has zero inputs. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/download_all_inputs.py#L27-L42 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/download_all_inputs.py | _gen_helper_dict | def _gen_helper_dict(filtered_inputs):
'''
Create a dict of values for the downloaded files. This is similar to the variables created
when running a bash app.
'''
file_key_descs, _ignore = file_load_utils.analyze_bash_vars(
file_load_utils.get_input_json_file(), None)
flattened_dict = {}
def add_if_no_collision(key, value, dict_):
if key not in dict_:
dict_[key] = value
for input_ in filtered_inputs:
if input_ not in file_key_descs:
continue
input_var_dict = file_key_descs[input_]
add_if_no_collision(input_ + '_path', input_var_dict["path"], flattened_dict)
add_if_no_collision(input_ + '_name', input_var_dict["basename"], flattened_dict)
add_if_no_collision(input_ + '_prefix', input_var_dict["prefix"], flattened_dict)
return flattened_dict | python | def _gen_helper_dict(filtered_inputs):
'''
Create a dict of values for the downloaded files. This is similar to the variables created
when running a bash app.
'''
file_key_descs, _ignore = file_load_utils.analyze_bash_vars(
file_load_utils.get_input_json_file(), None)
flattened_dict = {}
def add_if_no_collision(key, value, dict_):
if key not in dict_:
dict_[key] = value
for input_ in filtered_inputs:
if input_ not in file_key_descs:
continue
input_var_dict = file_key_descs[input_]
add_if_no_collision(input_ + '_path', input_var_dict["path"], flattened_dict)
add_if_no_collision(input_ + '_name', input_var_dict["basename"], flattened_dict)
add_if_no_collision(input_ + '_prefix', input_var_dict["prefix"], flattened_dict)
return flattened_dict | Create a dict of values for the downloaded files. This is similar to the variables created
when running a bash app. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/download_all_inputs.py#L82-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.