Skip to content

Commit

Permalink
Moved ~/.seammrc to ~/.seamm.d/seammrc
Browse files Browse the repository at this point in the history
Added better error messages when the Dashboard fails.
  • Loading branch information
paulsaxe committed Apr 22, 2024
1 parent 07855fd commit cfdc088
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=======
History
=======
2024.4.22 -- Moving user preferences to ~/.seamm.d
* Added better output when there are failures in the Dashboard.
* To better support Docker, moving ~/.seammrc to ~/.seamm.d/seamrc

2023.11.15 -- Bugfix: boolean options now work
* Boolean options were not handled correctly when submitting jobs.

Expand Down
35 changes: 31 additions & 4 deletions seamm_dashboard_client/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

logger = logging.getLogger(__name__)

logger.setLevel("DEBUG")


def safe_filename(filename):
if filename[0] == "~":
Expand Down Expand Up @@ -341,7 +343,7 @@ def login(self):
(
f"Could not log in to dashboard {self.name} as "
f"{self.username} / {self.password} ({result}). "
"Check ~/.seammrc for this information."
"Check ~/.seamm.d/seammrc for this information."
),
) # lgtm [py/clear-text-logging-sensitive-data]
elif response.status_code != 200:
Expand Down Expand Up @@ -523,16 +525,41 @@ def submit(
if len(files) == 0:
logger.info("There are no files to transfer.")
else:
logger.info("Transferring files:")
job = self.job(job_id)

# Now transfer the files
for filename, newname in files.items():
logger.info(f" {filename} --> {newname}")
result = job.put_file(filename, newname)
if result is None:
logger.warning(
f"There was an error transferring the file {filename} to "
f"{self.dashboard.name}."
f"There was a major error transferring the file {filename} to "
f"{self.name}."
)
elif result.status_code == 400:
logger.warning(
"A bad input parameters was sent to dashboard "
f"{self.name} transferring the file {filename} to it."
)
elif result.status_code == 403:
logger.warning(
"The user was not properly authorized on dashboard "
f"{self.name} transferring the file {filename} to it."
)
elif result.status_code == 500:
logger.warning(
"There was an internal error in dashboard "
f"{self.name} transferring the file {filename} to it."
)
elif result.status_code == 201:
pass
else:
logger.warning(
f"The dashboard {self.name} returned error code "
"{results.status_code} transferring the file {filename} to it."
)
logger.debug(str(result))

logger.info("Submitted job #{}".format(job_id))
return job_id
Expand Down Expand Up @@ -738,7 +765,7 @@ def jobs(self):
if response.status_code != 200:
logger.warning(
"Encountered an error getting the list of jobs for project "
f"{self.name} from dashboard {self.dashboard.name}, error code: "
f"{self.name} from dashboard {self.name}, error code: "
f"{response.status_code}"
)
return {}
Expand Down

0 comments on commit cfdc088

Please sign in to comment.