isabl-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- isabl_cli/VERSION +1 -0
- isabl_cli/__init__.py +25 -0
- isabl_cli/__main__.py +13 -0
- isabl_cli/api.py +815 -0
- isabl_cli/app.py +1926 -0
- isabl_cli/batch_systems/__init__.py +7 -0
- isabl_cli/batch_systems/local.py +44 -0
- isabl_cli/batch_systems/lsf.py +175 -0
- isabl_cli/batch_systems/sge.py +194 -0
- isabl_cli/batch_systems/slurm.py +180 -0
- isabl_cli/cli.py +91 -0
- isabl_cli/commands.py +480 -0
- isabl_cli/data/README.md +7 -0
- isabl_cli/data.py +1240 -0
- isabl_cli/exceptions.py +48 -0
- isabl_cli/factories.py +99 -0
- isabl_cli/options.py +407 -0
- isabl_cli/settings.py +315 -0
- isabl_cli/signals.py +23 -0
- isabl_cli/test/__init__.py +1 -0
- isabl_cli/test/utils.py +159 -0
- isabl_cli/utils.py +346 -0
- isabl_cli/validators.py +100 -0
- isabl_cli-0.1.0.dist-info/LICENSE.md +23 -0
- isabl_cli-0.1.0.dist-info/METADATA +40 -0
- isabl_cli-0.1.0.dist-info/RECORD +43 -0
- isabl_cli-0.1.0.dist-info/WHEEL +5 -0
- isabl_cli-0.1.0.dist-info/entry_points.txt +2 -0
- isabl_cli-0.1.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/conftest.py +26 -0
- tests/test_api.py +124 -0
- tests/test_app.py +1254 -0
- tests/test_batch_systems.py +87 -0
- tests/test_cli.py +34 -0
- tests/test_commands.py +341 -0
- tests/test_data.py +450 -0
- tests/test_options.py +28 -0
- tests/test_signals.py +59 -0
- tests/test_testutils.py +24 -0
- tests/test_utils.py +154 -0
- tests/test_validators.py +128 -0
- tests/test_version.py +8 -0
isabl_cli/utils.py
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"""Isabl CLI utils."""
|
|
2
|
+
|
|
3
|
+
from functools import update_wrapper
|
|
4
|
+
from getpass import getuser
|
|
5
|
+
from os import stat
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from pwd import getpwuid
|
|
8
|
+
import getpass
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import re
|
|
12
|
+
import sys
|
|
13
|
+
import tarfile
|
|
14
|
+
|
|
15
|
+
import analytics
|
|
16
|
+
import click
|
|
17
|
+
|
|
18
|
+
from packaging import version
|
|
19
|
+
from isabl_cli.settings import system_settings
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def makedirs(path, exist_ok=True, mode=0o777):
|
|
23
|
+
"""Make dirs ignoring umask."""
|
|
24
|
+
original_umask = os.umask(0)
|
|
25
|
+
os.makedirs(path, exist_ok=exist_ok, mode=mode)
|
|
26
|
+
os.umask(original_umask)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_results(
|
|
30
|
+
experiment,
|
|
31
|
+
result_key,
|
|
32
|
+
application_key=None,
|
|
33
|
+
application_name=None,
|
|
34
|
+
application_version=None,
|
|
35
|
+
targets=None,
|
|
36
|
+
references=None,
|
|
37
|
+
analyses=None,
|
|
38
|
+
status="SUCCEEDED",
|
|
39
|
+
raise_error=True,
|
|
40
|
+
):
|
|
41
|
+
"""
|
|
42
|
+
Match results from a experiment object.
|
|
43
|
+
|
|
44
|
+
If targets, references or analyses are provided the analysis result must
|
|
45
|
+
match these list of samples and dependencies. Match can be done by app pk, by app
|
|
46
|
+
name, or by app name and cversion.
|
|
47
|
+
|
|
48
|
+
Pass `result_key='storage_url'` to get the output directory.
|
|
49
|
+
|
|
50
|
+
Arguments:
|
|
51
|
+
experiment (dict): experiment object for which result will be retrieved.
|
|
52
|
+
result_key (dict): name of the result.
|
|
53
|
+
application_key (int): key of the application that generated the result.
|
|
54
|
+
application_name (str): name of the application that generated the result.
|
|
55
|
+
application_version (str): version of the application that generated the result.
|
|
56
|
+
targets (list): target experiments dicts that must match.
|
|
57
|
+
references (dict): reference experiments dicts that must match.
|
|
58
|
+
analyses (dict): analyses dicts that must match.
|
|
59
|
+
status (str): expected analysis status. For multiple, string with `\`.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
list: of tuples (result_value, analysis primary key).
|
|
63
|
+
"""
|
|
64
|
+
targets = {i.pk for i in targets or []}
|
|
65
|
+
references = {i.pk for i in references or []}
|
|
66
|
+
analyses = {i.pk for i in analyses or []}
|
|
67
|
+
|
|
68
|
+
# Filter candidates by same pk or name and/ version
|
|
69
|
+
experiment_results = []
|
|
70
|
+
for i in experiment.results:
|
|
71
|
+
if application_key:
|
|
72
|
+
if i.application.pk == application_key:
|
|
73
|
+
experiment_results.append(i)
|
|
74
|
+
elif application_name:
|
|
75
|
+
if (
|
|
76
|
+
application_version
|
|
77
|
+
and application_version != "latest"
|
|
78
|
+
):
|
|
79
|
+
if (
|
|
80
|
+
i.application.name == application_name
|
|
81
|
+
and i.application.version == application_version
|
|
82
|
+
):
|
|
83
|
+
experiment_results.append(i)
|
|
84
|
+
else:
|
|
85
|
+
if i.application.name == application_name:
|
|
86
|
+
experiment_results.append(i)
|
|
87
|
+
|
|
88
|
+
# Filter candidates by same targets/references/analyses
|
|
89
|
+
candidates = []
|
|
90
|
+
for i in experiment_results:
|
|
91
|
+
if targets and {j.pk for j in i.targets}.difference(
|
|
92
|
+
targets
|
|
93
|
+
): # pragma: no cover
|
|
94
|
+
continue
|
|
95
|
+
|
|
96
|
+
if references and {j.pk for j in i.references}.difference(
|
|
97
|
+
references
|
|
98
|
+
): # pragma: no cover
|
|
99
|
+
continue
|
|
100
|
+
|
|
101
|
+
if analyses and not analyses.issubset(
|
|
102
|
+
{j.pk for j in i.analyses}
|
|
103
|
+
): # pragma: no cover
|
|
104
|
+
continue
|
|
105
|
+
|
|
106
|
+
candidates.append(i)
|
|
107
|
+
|
|
108
|
+
# Return latest [`pk`] if more than 1 result and version is `latest`.
|
|
109
|
+
if len(candidates) > 1 and application_version == "latest":
|
|
110
|
+
candidates = [max(candidates, key=lambda x: x.pk)]
|
|
111
|
+
|
|
112
|
+
results = []
|
|
113
|
+
for i in candidates:
|
|
114
|
+
results_dict = i if result_key == "storage_url" else i.results
|
|
115
|
+
result = results_dict.get(result_key)
|
|
116
|
+
results.append((result, i.pk))
|
|
117
|
+
if raise_error:
|
|
118
|
+
assert result_key in results_dict, (
|
|
119
|
+
f"Result '{result_key}' not found for analysis {i.pk}"
|
|
120
|
+
f"({i.application.name} {i.application.version}) "
|
|
121
|
+
f"with status: {i.status}"
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
assert i.status in status.split("/") if status else True, (
|
|
125
|
+
f"Expected status '{status}' for result '{result_key}' did not match: "
|
|
126
|
+
f"{i.pk}({i.application.name} {i.application.version}) is {i.status}"
|
|
127
|
+
)
|
|
128
|
+
return results
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def get_result(*args, **kwargs):
|
|
132
|
+
"""
|
|
133
|
+
See get_results for full signature.
|
|
134
|
+
|
|
135
|
+
Arguments:
|
|
136
|
+
args (list): see get_results.
|
|
137
|
+
kwargs (dict): see get_results.
|
|
138
|
+
application_name (str): app name to display a more explicit error.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
tuple: result value, analysis pk that produced the result
|
|
142
|
+
"""
|
|
143
|
+
app_name = kwargs.get("application_name") or kwargs.get("application_key")
|
|
144
|
+
results = get_results(*args, **kwargs)
|
|
145
|
+
assert results, f"No results found for application: {app_name}"
|
|
146
|
+
if kwargs.get("application_version") != "latest":
|
|
147
|
+
assert len(results) == 1, f"Multiple results returned {results}"
|
|
148
|
+
result, key = results[0]
|
|
149
|
+
return result, key
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def traverse_dict(dictionary, keys, serialize=False):
|
|
153
|
+
"""
|
|
154
|
+
Traverse a `dictionary` using a list of `keys`.
|
|
155
|
+
|
|
156
|
+
Arguments:
|
|
157
|
+
dictionary (dict): dict to be traversed.
|
|
158
|
+
keys (list): keys to be explored.
|
|
159
|
+
serialize (bool): force to string, if value is dict use json.dumps.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
str: if `serialize` is True.
|
|
163
|
+
object: if `serialize` is false.
|
|
164
|
+
"""
|
|
165
|
+
value = dictionary
|
|
166
|
+
|
|
167
|
+
for i in keys:
|
|
168
|
+
try:
|
|
169
|
+
if isinstance(value, list):
|
|
170
|
+
value = [j.get(i, f"INVALID KEY ({i})") for j in value]
|
|
171
|
+
else:
|
|
172
|
+
value = value.get(i, f"INVALID KEY ({i})")
|
|
173
|
+
except AttributeError:
|
|
174
|
+
value = f"INVALID KEY ({i})"
|
|
175
|
+
|
|
176
|
+
if serialize:
|
|
177
|
+
if isinstance(value, dict):
|
|
178
|
+
value = json.dumps(value)
|
|
179
|
+
else:
|
|
180
|
+
value = str(value)
|
|
181
|
+
|
|
182
|
+
return value
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def apply_decorators(decorators):
|
|
186
|
+
"""
|
|
187
|
+
Apply a list of decorators to callable.
|
|
188
|
+
|
|
189
|
+
See: http://stackoverflow.com/questions/4122815
|
|
190
|
+
"""
|
|
191
|
+
decorators = reversed(decorators)
|
|
192
|
+
|
|
193
|
+
def decorator(f):
|
|
194
|
+
for i in decorators:
|
|
195
|
+
f = i(f)
|
|
196
|
+
return f
|
|
197
|
+
|
|
198
|
+
return decorator
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def get_rsync_command(src, dst, chmod="a-w"):
|
|
202
|
+
"""Get str for commant to move `src` directory to `dst`."""
|
|
203
|
+
return (
|
|
204
|
+
f"(chmod -R u+w {dst} || true) && "
|
|
205
|
+
f"rsync -va --append-verify --remove-source-files {src}/ {dst}/ && "
|
|
206
|
+
f"chmod -R {chmod} {dst} && "
|
|
207
|
+
f"find {src}/ -depth -type d -empty "
|
|
208
|
+
r'-exec rmdir "{}" \;'
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
def check_rsync_version(version_stdout):
|
|
212
|
+
"""Check for outdated rsync lacking the --append-verify."""
|
|
213
|
+
version_string = re.search(r'.*(?P<ver>\d\.\d\.\d).*', version_stdout).group("ver")
|
|
214
|
+
major_version = version.parse(version_string).major
|
|
215
|
+
if major_version != 3:
|
|
216
|
+
raise ValueError("Please upgrade your version of rsync!")
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def get_tree_size(path, follow_symlinks=False):
|
|
220
|
+
"""Return total size of directory in bytes."""
|
|
221
|
+
total = 0
|
|
222
|
+
for entry in os.scandir(path):
|
|
223
|
+
if entry.is_dir(follow_symlinks=follow_symlinks):
|
|
224
|
+
total += get_tree_size(entry.path)
|
|
225
|
+
else:
|
|
226
|
+
total += entry.stat(follow_symlinks=follow_symlinks).st_size
|
|
227
|
+
return total
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def force_link(src, dst):
|
|
231
|
+
"""Force a link between src and dst."""
|
|
232
|
+
try:
|
|
233
|
+
os.unlink(dst)
|
|
234
|
+
os.link(src, dst)
|
|
235
|
+
except OSError:
|
|
236
|
+
os.link(src, dst)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def force_symlink(src, dst):
|
|
240
|
+
"""Force a symlink between src and dst."""
|
|
241
|
+
try:
|
|
242
|
+
os.unlink(dst)
|
|
243
|
+
os.symlink(src, dst)
|
|
244
|
+
except OSError:
|
|
245
|
+
os.symlink(src, dst)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def tar_dir(output_path, source_dir):
|
|
249
|
+
"""Compress a `source_dir` in `output_path`."""
|
|
250
|
+
with tarfile.open(output_path, "w:gz") as tar:
|
|
251
|
+
tar.add(source_dir, arcname=os.path.basename(source_dir))
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def check_admin(msg=None):
|
|
255
|
+
"""Raise `PermissionError` if user is not `system_settings.ADMIN_USER`."""
|
|
256
|
+
admin = system_settings.ADMIN_USER
|
|
257
|
+
msg = msg or f"Operation can only be performed by {admin}"
|
|
258
|
+
|
|
259
|
+
if getpass.getuser() != admin:
|
|
260
|
+
raise PermissionError(msg)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def echo_add_commit_message():
|
|
264
|
+
"""Echo add `--commit` flag message."""
|
|
265
|
+
click.secho("\nAdd --commit to proceed.\n", fg="green", blink=True)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def echo_title(title, color="cyan", blink=False):
|
|
269
|
+
"""Echo a title."""
|
|
270
|
+
title = "\n" + title.strip().upper() + "\n"
|
|
271
|
+
title += "".join("-" for i in title.strip()) + "\n"
|
|
272
|
+
click.secho(title, fg=color, file=sys.stderr, blink=blink)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def find_owner(filename):
|
|
276
|
+
"""Find directory owner."""
|
|
277
|
+
return getpwuid(stat(filename).st_uid).pw_name
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def assert_same_owner(path):
|
|
281
|
+
"""Validate that a path is owned by the same user."""
|
|
282
|
+
try:
|
|
283
|
+
assert find_owner(path) == getuser(), f"{path} must be owned by {getuser()}"
|
|
284
|
+
except AssertionError as error: # pragma: no cover
|
|
285
|
+
raise click.UsageError(str(error))
|
|
286
|
+
except FileNotFoundError: # pragma: no cover
|
|
287
|
+
pass
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def called_from(depth=1, verbose=True):
|
|
291
|
+
"""Print where the current function was called from."""
|
|
292
|
+
ret = sys._getframe(1).f_code.co_name + f" -> was called from: (depth={depth})\n"
|
|
293
|
+
ret += "\n".join(
|
|
294
|
+
"\t" + sys._getframe(i).f_code.co_name + str(i) for i in range(3, 3 + depth)
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
if verbose: # pragma: no cover
|
|
298
|
+
print(ret)
|
|
299
|
+
|
|
300
|
+
return ret
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def send_analytics(command): # noqa
|
|
304
|
+
"""Can be used as method or decorator of click group commands to send analytics."""
|
|
305
|
+
|
|
306
|
+
@click.pass_context
|
|
307
|
+
def wrapper(ctx, *args, **kwargs):
|
|
308
|
+
"""Send track event after the command is executed."""
|
|
309
|
+
ctx.invoke(command, *args, **kwargs)
|
|
310
|
+
analytics.track(
|
|
311
|
+
system_settings.api_username,
|
|
312
|
+
"Ran cli command",
|
|
313
|
+
{"command": command.__name__, "args": args, "kwargs": kwargs},
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
return update_wrapper(wrapper, command)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def first_matching_file(directory, pattern, exclude=None):
|
|
320
|
+
"""
|
|
321
|
+
Recursively search within a directory for the first file that matches the pattern.
|
|
322
|
+
Args:
|
|
323
|
+
directory (str): the directory to search within.
|
|
324
|
+
pattern (str): a glob pattern (e.g., '*.txt') to match filenames.
|
|
325
|
+
exclude (str, optional): files containing this substring will be skipped.
|
|
326
|
+
|
|
327
|
+
Returns:
|
|
328
|
+
str: the path to the first matching file as a string.
|
|
329
|
+
|
|
330
|
+
Raises:
|
|
331
|
+
NotADirectoryError: If `directory` is not a valid directory.
|
|
332
|
+
FileNotFoundError: If no matching file is found.
|
|
333
|
+
"""
|
|
334
|
+
root_path = Path(directory)
|
|
335
|
+
if not root_path.is_dir(): # pragma: no cover
|
|
336
|
+
raise NotADirectoryError(f"{directory} is not a valid directory.")
|
|
337
|
+
|
|
338
|
+
matching_files = (
|
|
339
|
+
file for file in root_path.rglob(pattern)
|
|
340
|
+
if not (exclude and exclude in file.name)
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
try:
|
|
344
|
+
return str(next(matching_files))
|
|
345
|
+
except StopIteration: # pragma: no cover
|
|
346
|
+
raise FileNotFoundError(f"No file matching pattern '{pattern}' found in '{directory}'")
|
isabl_cli/validators.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""isabl_cli validators."""
|
|
2
|
+
|
|
3
|
+
from glob import glob
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
from isabl_cli import exceptions
|
|
7
|
+
from isabl_cli.api import get_instances
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def validate_patterns_are_files(patterns, check_size=True):
|
|
11
|
+
"""
|
|
12
|
+
Check that a list of `patterns` are valid files.
|
|
13
|
+
|
|
14
|
+
Arguments:
|
|
15
|
+
patterns (list): a list of patterns to be check.
|
|
16
|
+
check_size (bool): check size is not zero for all files matched.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
bool: True if all patterns match existing files.
|
|
20
|
+
"""
|
|
21
|
+
for pattern in patterns:
|
|
22
|
+
files = list(glob(pattern))
|
|
23
|
+
|
|
24
|
+
if not files:
|
|
25
|
+
msg = "{} pattern matched no files.".format(pattern)
|
|
26
|
+
raise exceptions.ValidationError(msg)
|
|
27
|
+
|
|
28
|
+
for i in files:
|
|
29
|
+
if not os.path.isfile(i):
|
|
30
|
+
msg = "{} is not a file.".format(i)
|
|
31
|
+
raise exceptions.ValidationError(msg)
|
|
32
|
+
|
|
33
|
+
if check_size and not os.path.getsize(i) > 0:
|
|
34
|
+
msg = "{} is an empty file.".format(i)
|
|
35
|
+
raise exceptions.ValidationError(msg)
|
|
36
|
+
|
|
37
|
+
return True
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def validate_patterns_are_dirs(patterns):
|
|
41
|
+
"""
|
|
42
|
+
Check that a list of `patterns` are valid dirs.
|
|
43
|
+
|
|
44
|
+
Arguments:
|
|
45
|
+
patterns (list): a list of directory patterns.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
bool: True if all patterns match existing directories.
|
|
49
|
+
"""
|
|
50
|
+
for pattern in patterns:
|
|
51
|
+
dirs = list(glob(pattern))
|
|
52
|
+
|
|
53
|
+
if not dirs:
|
|
54
|
+
msg = "{} pattern matched no dirs.".format(pattern)
|
|
55
|
+
raise exceptions.ValidationError(msg)
|
|
56
|
+
|
|
57
|
+
for i in dirs:
|
|
58
|
+
if not os.path.isdir(i):
|
|
59
|
+
msg = "{} is not a directory.".format(i)
|
|
60
|
+
raise exceptions.ValidationError(msg)
|
|
61
|
+
|
|
62
|
+
return True
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def validate_pairs(pairs):
|
|
66
|
+
"""Get experiments for pairs."""
|
|
67
|
+
if not pairs:
|
|
68
|
+
return []
|
|
69
|
+
|
|
70
|
+
ids = {i for pair in pairs for i in pair}
|
|
71
|
+
experiments = {i["system_id"]: i for i in get_instances("experiments", ids)}
|
|
72
|
+
ret = []
|
|
73
|
+
|
|
74
|
+
for target, reference in pairs:
|
|
75
|
+
if not target in experiments.keys():
|
|
76
|
+
raise exceptions.ValidationError(f"Experiment {target} not found.")
|
|
77
|
+
if not reference in experiments.keys():
|
|
78
|
+
raise exceptions.ValidationError(f"Experiment {reference} not found.")
|
|
79
|
+
ret.append(([experiments[str(target)]], [experiments[str(reference)]]))
|
|
80
|
+
|
|
81
|
+
return ret
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def validate_pairs_from_file(ctx, _, path):
|
|
85
|
+
"""Return pairs from tsv file."""
|
|
86
|
+
pairs = []
|
|
87
|
+
|
|
88
|
+
if path:
|
|
89
|
+
with open(path, "r") as f:
|
|
90
|
+
for i in f:
|
|
91
|
+
if i.startswith("#") or not i.strip():
|
|
92
|
+
continue
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
ids = i.strip().split("\t")
|
|
96
|
+
pairs.append((ids[0], ids[1]))
|
|
97
|
+
except IndexError:
|
|
98
|
+
raise exceptions.ValidationError(f"two columns required: {i}")
|
|
99
|
+
|
|
100
|
+
return validate_pairs(pairs)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Terms of Use - Academic Research
|
|
2
|
+
|
|
3
|
+
The isabl™ platform was developed and is maintained by the [Papaemmanuil Lab](https://www.mskcc.org/research-areas/labs/elli-papaemmanuil) at [Memorial Sloan Kettering Cancer Center (MSK)](https://mskcc.org). MSK may, from time to time, update these terms of use on the isabl™ platform source code and content (the “Software”).
|
|
4
|
+
|
|
5
|
+
MSK makes no warranties or representations, express or implied, with respect to any of the Software, including as to the present accuracy, completeness, timeliness, adequacy, or usefulness of any of the Software. The Software is not intended as a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your doctor or other qualified health provider with any questions you may have regarding your personal health or medical condition. By using the Software, you agree that MSK will not be liable for any losses or damages arising from your use of or reliance on the Software, or on other websites or information to which the Software may be linked. Inquiries about the Software, permitted uses of the Software, and other licenses to use the Software should be directed to [papaemme@mskcc.org](mailto:papaemme@mskcc.org).
|
|
6
|
+
|
|
7
|
+
Under this academic license, you may use the Software solely for your own personal and noncommercial use or research use in an academic or nonprofit setting, provided that all such uses must reference these Terms of Use and affix the following copyright notice to indicate MSK's rights in connection with your use of the Software:
|
|
8
|
+
|
|
9
|
+
© 2020 Memorial Sloan-Kettering Cancer Center. All rights reserved. Used with permission for research, educational, and noncommercial purposes only.
|
|
10
|
+
|
|
11
|
+
Unless you have signed a license agreement with MSK, you may not use any part of the Software for any other purpose, including:
|
|
12
|
+
|
|
13
|
+
1. use or incorporation into a commercial product or towards the performance of a commercial service;
|
|
14
|
+
2. research use in a commercial setting;
|
|
15
|
+
3. use for patient services; or
|
|
16
|
+
4. generation of reports in a hospital or other patient care setting.
|
|
17
|
+
|
|
18
|
+
The content and design of Software are protected by U.S. and international copyright laws. The Software or any portion thereof may not be reproduced, distributed, transferred, altered, used to create derivative works, or used in any manner, beyond your own personal and noncommercial use, without prior written consent from Memorial Sloan Kettering Cancer Center.
|
|
19
|
+
|
|
20
|
+
**“Memorial Sloan Kettering Cancer Center”** is a service mark of Memorial Sloan Kettering Cancer Center, 1275 York Avenue, New York, NY 10065. You agree not to use any trademarks or service marks of MSK other than within, and as they appear in, the Software or the copyright notice without MSK’s prior written consent. You further agree that you will not use the Software in any way that causes, or may cause, damage to the reputation, business, or goodwill of MSK.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
_© 2022 Memorial Sloan Kettering Cancer Center_
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: isabl-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: isabl_cli command line client.
|
|
5
|
+
Home-page: https://github.com/papaemmelab/isabl_cli
|
|
6
|
+
Author: Juan S. Medina
|
|
7
|
+
License: BSD
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: Unix
|
|
13
|
+
Classifier: Operating System :: POSIX
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
License-File: LICENSE.md
|
|
16
|
+
Requires-Dist: Click >=7.0.0
|
|
17
|
+
Requires-Dist: PyYAML >=5.3
|
|
18
|
+
Requires-Dist: analytics-python >=1.4.0
|
|
19
|
+
Requires-Dist: cached-property >=1.4.2
|
|
20
|
+
Requires-Dist: munch >=2.3.2
|
|
21
|
+
Requires-Dist: packaging >=21.0
|
|
22
|
+
Requires-Dist: python-slugify >=1.1.2
|
|
23
|
+
Requires-Dist: pytz >=2018.4
|
|
24
|
+
Requires-Dist: requests >=2.19.1
|
|
25
|
+
Requires-Dist: six >=1.11.0
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: black >=18.9b0 ; extra == 'test'
|
|
28
|
+
Requires-Dist: coverage >=4.4.2 ; extra == 'test'
|
|
29
|
+
Requires-Dist: factory-boy >=2.11.1 ; extra == 'test'
|
|
30
|
+
Requires-Dist: ipdb >=0.11 ; extra == 'test'
|
|
31
|
+
Requires-Dist: pluggy >=0.7.1 ; extra == 'test'
|
|
32
|
+
Requires-Dist: pydocstyle >=2.1.1 ; extra == 'test'
|
|
33
|
+
Requires-Dist: pylint >=1.8.1 ; extra == 'test'
|
|
34
|
+
Requires-Dist: pytest-cov >=2.5.1 ; extra == 'test'
|
|
35
|
+
Requires-Dist: pytest-env >=0.6.2 ; extra == 'test'
|
|
36
|
+
Requires-Dist: pytest-sugar >=0.9.1 ; extra == 'test'
|
|
37
|
+
Requires-Dist: pytest >=4.5 ; extra == 'test'
|
|
38
|
+
Requires-Dist: tox >=2.9.1 ; extra == 'test'
|
|
39
|
+
|
|
40
|
+
📘 learn more on `GitHub <https://github.com/papaemmelab/isabl_cli>`_!
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
isabl_cli/VERSION,sha256=6d2FB_S_DG9CRY5BrqgzrQvT9hJycjNe7pv01YVB7Wc,6
|
|
2
|
+
isabl_cli/__init__.py,sha256=zzKubiFMdpvn_Yr_7lx0qhogpJOeKrhe3xO1XC7We-s,882
|
|
3
|
+
isabl_cli/__main__.py,sha256=qvQid9WBzaTQbGAf8BbG3GEgxiD6jdvII1L475NXRjs,349
|
|
4
|
+
isabl_cli/api.py,sha256=ejjGW4d4pV_YpW4wEFJcRTQgYud6vO9wkiaypV7PYns,26612
|
|
5
|
+
isabl_cli/app.py,sha256=7BCWERJKkfaeDqy-vPyBs20MIJAmMxAdtB5n2Dq0NOg,70900
|
|
6
|
+
isabl_cli/cli.py,sha256=joFZPsd0AunWGQvDfbldRslyUHYYJbJB85SZLgflVw8,3014
|
|
7
|
+
isabl_cli/commands.py,sha256=2UiSvgfzwAXR4UMrK4dwZHxR9ivHro85zPR8js7CVqk,16269
|
|
8
|
+
isabl_cli/data.py,sha256=j6pSUUByL-8rsS3_liUh54taVSqLH-dibQ-hJWZeaNk,45282
|
|
9
|
+
isabl_cli/exceptions.py,sha256=-oP3MzZ3k6PBWKJJ6QsrxSjG2yAD50JBHur0ItyF3pA,1042
|
|
10
|
+
isabl_cli/factories.py,sha256=WGkmNEmoE8KeimMpvBvf3-N73n5xcsDF84Op110UzZE,3520
|
|
11
|
+
isabl_cli/options.py,sha256=zz7BgenKQJrBRkzlLSTlWj-3IakN-FcmPHoTPT_Jqm8,10153
|
|
12
|
+
isabl_cli/settings.py,sha256=4m5PSoxpNzCNp0O3WJgFdGhOT6rHNuMJK1K_B6H_MO4,10265
|
|
13
|
+
isabl_cli/signals.py,sha256=meEs0pXSV91vUaPKPutY_KhV3DE6duNJmELybN-SRs8,753
|
|
14
|
+
isabl_cli/utils.py,sha256=Srt_o1vkyNC2nL8erVAnnQx8tALkT37ZFt4gI2O063o,10854
|
|
15
|
+
isabl_cli/validators.py,sha256=-7mtITWfQvKfsq5zT4LXfnxbB8LxYavwfj4L-2c_1V0,2850
|
|
16
|
+
isabl_cli/batch_systems/__init__.py,sha256=iUVmIbqMlXA5MgSXx3ZC3WwUUDvUgkCV-cCuf6QKy00,143
|
|
17
|
+
isabl_cli/batch_systems/local.py,sha256=OvG4QmM57sGRpU471TYfwXIbvejiuZaGkePBI3xMwg0,1411
|
|
18
|
+
isabl_cli/batch_systems/lsf.py,sha256=wnYvyD_WvIEpXllH62n929lE1UQOVrQykeXcg9Uma34,6178
|
|
19
|
+
isabl_cli/batch_systems/sge.py,sha256=WSxkFD9cwBNVcTgHoxXQpwLmRUAYvWHOc4JuZB9GMvQ,6282
|
|
20
|
+
isabl_cli/batch_systems/slurm.py,sha256=59EeZn89pmHyjTlErEJs94m_5VEB1wP-aSL2mkWNZVc,6661
|
|
21
|
+
isabl_cli/data/README.md,sha256=eMBsTHJbN6BGTFzVWNxpAro3k7FIvdIZMWECvqIhJcE,315
|
|
22
|
+
isabl_cli/test/__init__.py,sha256=WEhbAyoh5rUYKrNkbOtrIevV3fhOwlw0PQbbga144JA,56
|
|
23
|
+
isabl_cli/test/utils.py,sha256=YqO8PM_2g8ZKJW2RAxhXVE851wMNJ7LVEbU5WA07tVo,4986
|
|
24
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
+
tests/conftest.py,sha256=EpmYas5EY1ABY0iFUdGc63_sItF9yyUsJMXeLp9zE38,1073
|
|
26
|
+
tests/test_api.py,sha256=BqSuplKGh_sgbu12GbhFtwujVHEvJoMZ-nm1mIHqTEY,4359
|
|
27
|
+
tests/test_app.py,sha256=5ZnQ--iKPkuDTd4p7i2DaB2BnDSImFKCmx82YtdG1t4,43538
|
|
28
|
+
tests/test_batch_systems.py,sha256=COxDDJZrwAudHCPC2uUuWehUBIyuOgyr0kysclnqmfA,2805
|
|
29
|
+
tests/test_cli.py,sha256=3GLO4JKKbkpvdgCBmUUr4uuHRAcnU4cTEAgdZ4_Ri6c,1081
|
|
30
|
+
tests/test_commands.py,sha256=oWFK7Dp7TlUNVWmFvtfFCkXPUja6OpqCOY0LPKWw2mM,12057
|
|
31
|
+
tests/test_data.py,sha256=WNFy89_NPNQ6pbtZgepuUxQYKep5JFpyf1nt2ZdU8jk,16356
|
|
32
|
+
tests/test_options.py,sha256=6-bjgsg7CcPc9ptgK4MTxWqzNu58_8yZl2ufQT2o2pE,791
|
|
33
|
+
tests/test_signals.py,sha256=ZNTUxaagxwDJ2PLnpalBDz0-Mw8wvAemoV5HCh5nszs,2246
|
|
34
|
+
tests/test_testutils.py,sha256=YOLVWJlvsw5m8sBrkPNNt3tHewewz5Sijmdt3EO1604,736
|
|
35
|
+
tests/test_utils.py,sha256=i3sDE-QApMlRZfDWed5bYxhHS8BNN9FDgLreQ2CrMns,4004
|
|
36
|
+
tests/test_validators.py,sha256=Hy5v3nNJ2x5_nFaTArMSfHQGGkRHZiHJqbU_eqvQjj4,4649
|
|
37
|
+
tests/test_version.py,sha256=uwyMV2GQfUfO8PjFJ6bipvZwLGk2TWIEPTUIyW6LI7w,162
|
|
38
|
+
isabl_cli-0.1.0.dist-info/LICENSE.md,sha256=_19PhB_9-zf4Ca2e4mOeYBPJV7TXiSCsFJVqnkPDiZU,2985
|
|
39
|
+
isabl_cli-0.1.0.dist-info/METADATA,sha256=MsF5E2xZvTtLqSfWs8xlJREG-GlJljNbPHOWSIArNQA,1511
|
|
40
|
+
isabl_cli-0.1.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
41
|
+
isabl_cli-0.1.0.dist-info/entry_points.txt,sha256=BmjqFW7-dxYmkl4WDZv_VgnaFoyroNz0npoHhJ96XfI,45
|
|
42
|
+
isabl_cli-0.1.0.dist-info/top_level.txt,sha256=e_rNVRVMhuMCaU95qx2i9xw4PU94nVq4r3WmAnNcrTI,16
|
|
43
|
+
isabl_cli-0.1.0.dist-info/RECORD,,
|
tests/__init__.py
ADDED
|
File without changes
|
tests/conftest.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from isabl_cli.api import create_instance, patch_instance, get_instance
|
|
4
|
+
from isabl_cli.settings import _DEFAULTS
|
|
5
|
+
|
|
6
|
+
def pytest_sessionstart():
|
|
7
|
+
"""Run before any test starts."""
|
|
8
|
+
client_cli_id = "test-cli-client"
|
|
9
|
+
client_api_id = "default-backend-settings"
|
|
10
|
+
new_settings_cli = {"EXTRA_RAW_DATA_FORMATS": [(r"\.tf(\.gz)?$", "TEST_FORMAT")]}
|
|
11
|
+
new_settings_api = {"EXTRA_RAW_DATA_FORMATS": [("TEST_FORMAT", "TEST_FORMAT")]}
|
|
12
|
+
|
|
13
|
+
# Get or create the test cli client and patch its settings
|
|
14
|
+
client_cli = create_instance("clients", slug=client_cli_id)
|
|
15
|
+
client_cli = patch_instance("clients", client_cli.pk, settings=new_settings_cli)
|
|
16
|
+
|
|
17
|
+
# Get or create the test backend client and patch its settings
|
|
18
|
+
client_api = get_instance("clients", client_api_id)
|
|
19
|
+
client_api = patch_instance("clients", client_api.pk, settings=new_settings_api)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
23
|
+
def set_data_dir(tmpdir_factory):
|
|
24
|
+
"""Set data dir for all tests."""
|
|
25
|
+
_DEFAULTS["BASE_STORAGE_DIRECTORY"] = tmpdir_factory.mktemp("data").strpath
|
|
26
|
+
|