Skip to content

Commit 0b0a75b

Browse files
committed
Merge branch 'sub_queue_and_find_py_venv' into release-0.15.3
2 parents 397c8b7 + cec46cb commit 0b0a75b

File tree

6 files changed

+71
-36
lines changed

6 files changed

+71
-36
lines changed

firecloud/api.py

+28-7
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ def get_entity(namespace, workspace, etype, ename, api_root=PROD_API_ROOT):
273273
api_root, namespace, workspace, etype, ename)
274274
return __get(uri)
275275

276+
276277
def delete_entities(namespace, workspace, json_body, api_root=PROD_API_ROOT):
277278
"""Delete entities in a workspace.
278279
@@ -812,7 +813,7 @@ def update_repository_method(namespace, method, synopsis,
812813

813814
def delete_repository_method(namespace, name, snapshot_id,
814815
api_root=PROD_API_ROOT):
815-
"""Redact a version of a workflow.
816+
"""Redacts a method and all of its associated configurations.
816817
817818
The method should exist in the methods repository.
818819
@@ -823,10 +824,27 @@ def delete_repository_method(namespace, name, snapshot_id,
823824
api_root (str): FireCloud API url, if not production
824825
825826
Swagger:
826-
UNDOCUMENTED
827+
https://api.firecloud.org/#!/Method_Repository/delete_api_methods_namespace_name_snapshotId
827828
"""
828-
uri = "{0}/methods/{1}/{2}/{3}".format(api_root, namespace,
829-
name, snapshot_id)
829+
uri = "{0}/methods/{1}/{2}/{3}".format(api_root, namespace, name, snapshot_id)
830+
return __delete(uri)
831+
832+
def delete_repository_config(namespace, name, snapshot_id,
833+
api_root=PROD_API_ROOT):
834+
"""Redacts a configuration and all of its associated configurations.
835+
836+
The configuration should exist in the methods repository.
837+
838+
Args:
839+
namespace (str): configuration namespace
840+
configuration (str): configuration name
841+
snapshot_id (int): snapshot_id of the configuration
842+
api_root (str): FireCloud API url, if not production
843+
844+
Swagger:
845+
https://api.firecloud.org/#!/Method_Repository/delete_api_configurations_namespace_name_snapshotId
846+
"""
847+
uri = "{0}/configurations/{1}/{2}/{3}".format(api_root, namespace, name, snapshot_id)
830848
return __delete(uri)
831849

832850
def get_repository_method_acl(namespace, method,
@@ -1089,7 +1107,7 @@ def list_workspaces(api_root=PROD_API_ROOT):
10891107
"""
10901108
return __get(api_root+ "/workspaces")
10911109

1092-
def create_workspace(namespace, name, protected=False,
1110+
def create_workspace(namespace, name, authorizationDomain = "",
10931111
attributes=None, api_root=PROD_API_ROOT):
10941112
"""Create a new FireCloud Workspace.
10951113
@@ -1108,12 +1126,15 @@ def create_workspace(namespace, name, protected=False,
11081126
uri = "{0}/workspaces".format(api_root)
11091127
if not attributes:
11101128
attributes = dict()
1129+
11111130
body = {
11121131
"namespace": namespace,
11131132
"name": name,
1114-
"attributes": attributes,
1115-
"isProtected": protected
1133+
"attributes": attributes
11161134
}
1135+
if authorizationDomain:
1136+
body["authorizationDomain"] = {"membersGroupName": authorizationDomain}
1137+
11171138
return __post(uri, json=body)
11181139

11191140
def delete_workspace(namespace, workspace,api_root=PROD_API_ROOT):

firecloud/fiss.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def space_lock(args):
8484
def space_new(args):
8585
""" Create a new workspace. """
8686
r = fapi.create_workspace(args.project, args.workspace,
87-
args.protected, dict(), args.api_url)
87+
args.authdomain, dict(), args.api_url)
8888
fapi._check_response_code(r, 201)
8989
print_('Created workspace {0}/{1}'.format(args.project, args.workspace))
9090
if fapi.get_verbosity():
@@ -1528,9 +1528,9 @@ def main(argv=None):
15281528
# Create Workspace
15291529
subp = subparsers.add_parser('space_new', parents=[workspace_parent],
15301530
description='Create new workspace')
1531-
phelp = 'Create a protected (dbGaP-controlled) workspace.'
1532-
phelp += 'You must have linked NIH credentials for this option.'
1533-
subp.add_argument('--protected', action='store_true', help=phelp)
1531+
phelp = 'Limit access to the workspace to a specific authorization domain. '
1532+
phelp += 'For dbGaP-controlled access (domain name: dbGapAuthorizedUsers) you must have linked NIH credentials to your account.'
1533+
subp.add_argument('--authdomain', default="", help=phelp)
15341534
subp.set_defaults(func=space_new)
15351535

15361536
# Determine existence of workspace

firecloud/tests/highlevel_tests.py

100644100755
+8-2
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,22 @@
1313

1414
# Context manager to capture stdout when calling another function
1515
# Source: http://stackoverflow.com/questions/16571150/how-to-capture-stdout-output-from-a-python-function-call
16-
from cStringIO import StringIO
16+
# from cStringIO import StringIO
17+
# replace cStringIO with StringIO for python3 compatibility
18+
from io import StringIO
1719
import sys
20+
import ast
1821

1922
class Capturing(list):
2023
def __enter__(self):
2124
self._stdout = sys.stdout
2225
sys.stdout = self._stringio = StringIO()
2326
return self
2427
def __exit__(self, *args):
25-
self.extend(self._stringio.getvalue().splitlines())
28+
if sys.version_info[0] < 3:
29+
self.extend(self._stringio.getvalue().splitlines())
30+
else:
31+
self.extend(ast.literal_eval(self._stringio.getvalue()).decode().splitlines())
2632
del self._stringio # free up some memory
2733
sys.stdout = self._stdout
2834

firecloud/tests/lowlevel_tests.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,11 @@ def test_get_submission(self):
233233
"""Test get_submission()."""
234234
pass
235235

236-
@unittest.skip("Not Implemented")
237236
def test_get_submission_queue(self):
238237
"""Test get_submission_queue()."""
239-
pass
238+
r = fapi.get_submission_queue()
239+
print_(r.status_code, r.content)
240+
self.assertEqual(r.status_code, 200)
240241

241242
@unittest.skip("Not Implemented")
242243
def test_get_workflow_outputs(self):

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
'requests',
2828
'six',
2929
'yapsy',
30+
'nose',
3031
'pylint==1.7.1'
3132
],
3233
classifiers = [

util/findPython.sh

+27-21
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
11
#!/bin/bash
22

3-
# findPython.sh: help determine installation location for this package,
4-
# by identifying existing candidate Python installations
3+
# config.sh: Help determine installation location for gdctools package,
4+
# by identifying existing Python installations as candidates.
55

66
InstallDir=
77

8-
# Use any Python3 installation, or Python2 if >= 2.7
9-
Python=`type -P python`
10-
if [ -n "$Python" ] ; then
11-
case `python --version 2>&1 | awk '{print $NF}'` in
12-
2.7*| 3.*)
13-
InstallDir=`dirname $Python`
14-
InstallDir=`dirname $InstallDir`
15-
;;
16-
esac
8+
if [ -n "$1" ] ; then
9+
PythonExe=$1
10+
shift
11+
else
12+
PythonExe=python
1713
fi
1814

15+
# For convenience, give precedence to well-known directories @ Broad Institute
16+
BroadDirs="/local/firebrowse/latest /xchip/tcga/Tools/gdac/latest"
17+
for dir in $BroadDirs ; do
18+
if [ -d $dir ] ; then
19+
InstallDir=$dir
20+
break
21+
fi
22+
done
23+
1924
if [ -z "$InstallDir" ] ; then
20-
# Nothing found: for convenience, look for well-known dirs @ Broad Institute
21-
BroadDirs="/local/firebrowse/latest /xchip/tcga/Tools/gdac/latest"
22-
for dir in $BroadDirs ; do
23-
if [ -d $dir ] ; then
24-
InstallDir=$dir
25-
break
26-
fi
27-
done
25+
if [ -n "$VIRTUAL_ENV" ] ; then
26+
InstallDir=$VIRTUAL_ENV
27+
else
28+
Python=`type -P $PythonExe`
29+
if [ -n "$Python" ]; then
30+
InstallDir=`dirname $Python`
31+
InstallDir=`dirname $InstallDir`
32+
fi
33+
fi
2834
fi
2935

3036
if [ -z "$InstallDir" ] ; then
31-
echo "Error: could not find an appropriate python installation to use" >&2
37+
echo "Error: could not find a $PythonExe installation to use" >&2
3238
exit 1
3339
fi
3440

3541
echo "$InstallDir"
36-
exit 0
42+
exit 0

0 commit comments

Comments
 (0)