Skip to content

Commit

Permalink
Unscheduled changes for integration work.
Browse files Browse the repository at this point in the history
  • Loading branch information
bschroeter committed Aug 30, 2024
1 parent 397a300 commit 7397cc0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
3 changes: 2 additions & 1 deletion meorg_client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ def cli_analysis():
# Add file commands
cli_file.add_command(file_list)
cli_file.add_command(file_upload)
# cli_file.add_command(file_upload_parallel)
cli_file.add_command(file_attach)
cli_file.add_command(file_detach_all)


# Add endpoint commands
cli_endpoints.add_command(list_endpoints)
Expand Down
30 changes: 29 additions & 1 deletion meorg_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,22 @@ def upload_files(
response = self._upload_file(fp, attach_to=attach_to)
responses.append(response)
else:

# Disable the auto attach to avoid race condition
responses = self._upload_files_parallel(
files, n=n, attach_to=attach_to, progress=progress
files, n=n, attach_to=None, progress=progress
)

if attach_to:

file_ids = list()

for response in responses:
file_id = response.get("data").get("files")[0].get("file")
file_ids.append(file_id)

self.attach_files_to_model_output(id=attach_to, files=file_ids)

return mu.ensure_list(responses)

def _upload_file(
Expand Down Expand Up @@ -503,3 +515,19 @@ def success(self) -> bool:
True if successful, False otherwise.
"""
return self.last_response.status_code in mcc.HTTP_STATUS_SUCCESS_RANGE

def is_initialised(self, dev: bool = False) -> bool:
"""Check if the client is initialised.
NOTE: This does not check the login actually works.
Parameters
----------
dev : bool, optional
Use dev credentials, by default False
Returns
-------
bool
True if initialised, False otherwise.
"""
cred_filename = "credentials.json" if not dev else "credentials-dev.json"
cred_filepath = mu.get_user_data_filepath(cred_filename)
return cred_filepath.exists()
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ license = {file="LICENSE"}
dynamic = ["version"]

# Dependencies
requires-python = ">=3.11"
requires-python = ">=3.9"
dependencies = [
"requests>=2.31.0",
"requests-mock>=1.11.0",
"PyYAML>=6.0.1",
"click>=8.1.7",
"pandas>=2.2.2"
"pandas>=2.2.2",
"tqdm>=4.66.5"
]

authors = [
Expand Down

0 comments on commit 7397cc0

Please sign in to comment.