Skip to content

Commit 13a5841

Browse files
authored
Merge pull request #55 from CABLE-LSM/integration-patch
Unscheduled changes for integration work.
2 parents 397a300 + 7397cc0 commit 13a5841

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

meorg_client/cli.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ def cli_analysis():
286286
# Add file commands
287287
cli_file.add_command(file_list)
288288
cli_file.add_command(file_upload)
289-
# cli_file.add_command(file_upload_parallel)
290289
cli_file.add_command(file_attach)
290+
cli_file.add_command(file_detach_all)
291+
291292

292293
# Add endpoint commands
293294
cli_endpoints.add_command(list_endpoints)

meorg_client/client.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,22 @@ def upload_files(
291291
response = self._upload_file(fp, attach_to=attach_to)
292292
responses.append(response)
293293
else:
294+
295+
# Disable the auto attach to avoid race condition
294296
responses = self._upload_files_parallel(
295-
files, n=n, attach_to=attach_to, progress=progress
297+
files, n=n, attach_to=None, progress=progress
296298
)
297299

300+
if attach_to:
301+
302+
file_ids = list()
303+
304+
for response in responses:
305+
file_id = response.get("data").get("files")[0].get("file")
306+
file_ids.append(file_id)
307+
308+
self.attach_files_to_model_output(id=attach_to, files=file_ids)
309+
298310
return mu.ensure_list(responses)
299311

300312
def _upload_file(
@@ -503,3 +515,19 @@ def success(self) -> bool:
503515
True if successful, False otherwise.
504516
"""
505517
return self.last_response.status_code in mcc.HTTP_STATUS_SUCCESS_RANGE
518+
519+
def is_initialised(self, dev: bool = False) -> bool:
520+
"""Check if the client is initialised.
521+
NOTE: This does not check the login actually works.
522+
Parameters
523+
----------
524+
dev : bool, optional
525+
Use dev credentials, by default False
526+
Returns
527+
-------
528+
bool
529+
True if initialised, False otherwise.
530+
"""
531+
cred_filename = "credentials.json" if not dev else "credentials-dev.json"
532+
cred_filepath = mu.get_user_data_filepath(cred_filename)
533+
return cred_filepath.exists()

pyproject.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ license = {file="LICENSE"}
1818
dynamic = ["version"]
1919

2020
# Dependencies
21-
requires-python = ">=3.11"
21+
requires-python = ">=3.9"
2222
dependencies = [
2323
"requests>=2.31.0",
2424
"requests-mock>=1.11.0",
2525
"PyYAML>=6.0.1",
2626
"click>=8.1.7",
27-
"pandas>=2.2.2"
27+
"pandas>=2.2.2",
28+
"tqdm>=4.66.5"
2829
]
2930

3031
authors = [

0 commit comments

Comments
 (0)