Skip to content

Commit 0440e48

Browse files
dheimanluke-c-sargentDailyDreaming
authored
v0.16.29 (#149)
api.py: * added fields parameter to get_workspace() fiss.py: * space_exists(), attr_get(), attr_copy(), mop(), validate_file_attrs(), and config_validate() updated to use fields parameter in call to get_workspace() py3 compatibility bugfixes: * setup.py: - easy_install removed to enable compatibility with latest setuptools * fccore.py: - tempfile generated in edit_text() now opens in mode 'w' instead of 'w+b' to work with both py2 and py3 str objects. Co-authored-by: Luke Sargent <luke.c.sargent@gmail.com> Co-authored-by: DailyDreaming <lblauvel@ucsc.edu>
1 parent 2e7c05a commit 0440e48

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed

changelog.txt

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ Change Log for FISSFC: the (Fi)recloud (S)ervice (S)elector
33
=======================================================================
44
Terms used below: HL = high level interface, LL = low level interface
55

6+
v0.16.29 - LL: added fields parameter to get_workspace; HL: space_exists,
7+
attr_get, attr_copy, mop, validate_file_attrs, and config_validate
8+
updated to use fields parameter in call to get_workspace; py3 fixes:
9+
easy_install removed from setup.py to enable compatibility with
10+
latest setuptools, tempfile generated in fccore.edit_text now opens
11+
in mode 'w' instead of 'w+b' to work with both py2 and py3 str.
12+
613
v0.16.28 - LL: added fields parameter to list_workspaces; HL: space_list and
714
space_search updated to use fields parameter in call to
815
list_workspaces, proj_list fixed to enable py3 compatibility.

firecloud/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Package version
2-
__version__ = "0.16.28"
2+
__version__ = "0.16.29"

firecloud/api.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1219,18 +1219,25 @@ def delete_workspace(namespace, workspace):
12191219
uri = "workspaces/{0}/{1}".format(namespace, workspace)
12201220
return __delete(uri)
12211221

1222-
def get_workspace(namespace, workspace):
1222+
def get_workspace(namespace, workspace, fields=None):
12231223
"""Request FireCloud Workspace information.
12241224
12251225
Args:
12261226
namespace (str): project to which workspace belongs
12271227
workspace (str): Workspace name
1228+
fields (str): a comma-delimited list of values that limits the
1229+
response payload to include only those keys and exclude other
1230+
keys (e.g., to include {"workspace": {"attributes": {...}}},
1231+
specify "workspace.attributes").
12281232
12291233
Swagger:
12301234
https://api.firecloud.org/#!/Workspaces/getWorkspace
12311235
"""
12321236
uri = "workspaces/{0}/{1}".format(namespace, workspace)
1233-
return __get(uri)
1237+
if fields is None:
1238+
return __get(uri)
1239+
else:
1240+
return __get(uri, params={"fields": fields})
12341241

12351242
def get_workspace_acl(namespace, workspace):
12361243
"""Request FireCloud access aontrol list for workspace.

firecloud/fccore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def config_parse(files=None, config=None, config_profile=".fissconfig", **kwargs
189189

190190
def edit_text(text=None):
191191
# Edit block of text in a single string, returning the edited result
192-
tf = tempfile.NamedTemporaryFile(suffix=".tmp")
192+
tf = tempfile.NamedTemporaryFile(suffix=".tmp", mode='w')
193193
if text:
194194
tf.write(text)
195195
tf.flush()

firecloud/fiss.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def space_exists(args):
6868
# ...
6969
# fi
7070
try:
71-
r = fapi.get_workspace(args.project, args.workspace)
71+
r = fapi.get_workspace(args.project, args.workspace, fields="workspace.name")
7272
fapi._check_response_code(r, 200)
7373
exists = True
7474
except FireCloudServerError as e:
@@ -873,7 +873,7 @@ def attr_get(args):
873873
for k in ["samples", "participants", "pairs"]:
874874
attrs.pop(k, None)
875875
else:
876-
r = fapi.get_workspace(args.project, args.workspace)
876+
r = fapi.get_workspace(args.project, args.workspace, fields="workspace.attributes")
877877
fapi._check_response_code(r, 200)
878878
attrs = r.json()['workspace']['attributes']
879879

@@ -1047,7 +1047,7 @@ def attr_copy(args):
10471047
return 1
10481048

10491049
# First get the workspace attributes of the source workspace
1050-
r = fapi.get_workspace(args.project, args.workspace)
1050+
r = fapi.get_workspace(args.project, args.workspace, fields="workspace.attributes")
10511051
fapi._check_response_code(r, 200)
10521052

10531053
# Parse the attributes
@@ -1206,7 +1206,8 @@ def mop(args):
12061206
# First retrieve the workspace to get bucket information
12071207
if args.verbose:
12081208
print("Retrieving workspace information...")
1209-
r = fapi.get_workspace(args.project, args.workspace)
1209+
fields = "workspace.bucketName,workspace.name,workspace.attributes"
1210+
r = fapi.get_workspace(args.project, args.workspace, fields=fields)
12101211
fapi._check_response_code(r, 200)
12111212
workspace = r.json()
12121213
bucket = workspace['workspace']['bucketName']
@@ -1405,7 +1406,7 @@ def validate_file_attrs(args):
14051406
verbose = fcconfig.verbosity
14061407
if verbose:
14071408
eprint("Retrieving workspace information...")
1408-
r = fapi.get_workspace(args.project, args.workspace)
1409+
r = fapi.get_workspace(args.project, args.workspace, fields="workspace.attributes")
14091410
fapi._check_response_code(r, 200)
14101411
workspace = r.json()
14111412

@@ -1622,7 +1623,7 @@ def config_validate(args):
16221623
entity_d = entity_r.json()
16231624

16241625
# also get the workspace info
1625-
w = fapi.get_workspace(args.project, args.workspace)
1626+
w = fapi.get_workspace(args.project, args.workspace, fields="workspace.attributes")
16261627
fapi._check_response_code(w, 200)
16271628
workspace_d = w.json()
16281629

setup.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
import os
2+
import sys
23
import platform
34
import contextlib
45
import tempfile
56
import subprocess
7+
from distutils import log
8+
from shutil import rmtree
69
from setuptools import setup, find_packages, Command
710
from setuptools.command.install import install
811
from setuptools.package_index import PackageIndex
9-
from setuptools.command.easy_install import six, rmtree_safe, rmtree, log
1012
from firecloud.__about__ import __version__
1113
from firecloud import which
1214
_README = os.path.join(os.path.dirname(__file__), 'README')
1315
_LONG_DESCRIPTION = open(_README).read()
1416

17+
# Workaround for http://bugs.python.org/issue24672
18+
linux_py2_ascii = platform.system() == 'Linux' and sys.version_info.major == 2
19+
rmtree_safe = str if linux_py2_ascii else lambda x: x
20+
1521
class InstallCommand(install):
1622
def needs_gcloud(self):
1723
"""Returns true if gcloud is unavailable and needed for
@@ -58,7 +64,7 @@ def finalize_options(self):
5864
# Copied from setuptools.command.easy_install.easy_install
5965
@contextlib.contextmanager
6066
def _tmpdir(self):
61-
tmpdir = tempfile.mkdtemp(prefix=six.u("install_gcloud-"))
67+
tmpdir = tempfile.mkdtemp(prefix="install_gcloud-".encode('utf-8').decode('utf-8'))
6268
try:
6369
# cast to str as workaround for #709 and #710 and #712
6470
yield str(tmpdir)

0 commit comments

Comments
 (0)