From cfdc088b1e09d3afcea8886220edd197ff258f99 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Mon, 22 Apr 2024 13:48:48 -0400 Subject: [PATCH 1/2] Moved ~/.seammrc to ~/.seamm.d/seammrc Added better error messages when the Dashboard fails. --- HISTORY.rst | 4 ++++ seamm_dashboard_client/dashboard.py | 35 +++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 0d15063..4f78a1c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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. diff --git a/seamm_dashboard_client/dashboard.py b/seamm_dashboard_client/dashboard.py index 9eb0357..790f1d5 100644 --- a/seamm_dashboard_client/dashboard.py +++ b/seamm_dashboard_client/dashboard.py @@ -20,6 +20,8 @@ logger = logging.getLogger(__name__) +logger.setLevel("DEBUG") + def safe_filename(filename): if filename[0] == "~": @@ -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: @@ -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 @@ -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 {} From 9c661a590afba531897d1caa438d67f44e440dcb Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Mon, 22 Apr 2024 15:44:36 -0400 Subject: [PATCH 2/2] Updated versioneer. --- versioneer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioneer.py b/versioneer.py index 64fea1c..3aa5da3 100644 --- a/versioneer.py +++ b/versioneer.py @@ -339,9 +339,9 @@ def get_config_from_root(root): # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") - parser = configparser.SafeConfigParser() + parser = configparser.ConfigParser() with open(setup_cfg, "r") as f: - parser.readfp(f) + parser.read_file(f) VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name):