diff --git a/transfer_service/import_executor.py b/transfer_service/import_executor.py index d79fb31e4c5a5451bb50dd879fc009f187668a33..99fac244a1b5e4702f5e1ef797bee3e0b2c54001 100644 --- a/transfer_service/import_executor.py +++ b/transfer_service/import_executor.py @@ -35,7 +35,7 @@ class ImportExecutor(TaskExecutor): params.getint("port"), params["db"], 1, - 1) + 1) params = config.loadSection("mail") self.adminEmail = params["admin_email"] params = config.loadSection("logging") @@ -53,7 +53,7 @@ class ImportExecutor(TaskExecutor): params.getint("port"), params["user"], params["pkey_file_path"], - self.logger) + self.logger) self.systemUtils = SystemUtils() self.jobObj = None self.jobId = None @@ -175,7 +175,7 @@ class ImportExecutor(TaskExecutor): try: results = [{"target": ""}] self.dbConn.setResults(self.jobId, results) - + m = Mailer(self.logger) m.addRecipient(self.adminEmail) @@ -195,12 +195,12 @@ class ImportExecutor(TaskExecutor): headers = [ "Timestamp", "OS path", "VOSpace path", "Node type", "Result"], tablefmt = "simple")) nlfp.close() - + self.jobObj.setPhase("COMPLETED") self.jobObj.setEndTime(datetime.datetime.now().isoformat()) self.dbConn.insertJob(self.jobObj) self.logger.info("Job phase updated to COMPLETED.") - + msg = f""" ########## VOSpace import procedure summary ########## @@ -215,12 +215,12 @@ class ImportExecutor(TaskExecutor): Symlinks detected: {sum(res[-1] == 'SYMLINK' for res in self.nodeList)} """ - - if len(self.nodeList) <= 10 ** 5: + + if len(self.nodeList) <= 10 ** 5: m.setMessageWithAttachment("VOSpace import notification", msg, nodeListFile) else: info = f""" - INFO: + INFO: this operation involved a number of nodes greater than 10^5, you will find the results in {self.resDir}. @@ -234,7 +234,7 @@ class ImportExecutor(TaskExecutor): self.jobObj.setEndTime(datetime.datetime.now().isoformat()) self.dbConn.insertJob(self.jobObj) self.logger.info("Job phase updated to ERROR.") - + msg = f""" ########## VOSpace import procedure summary ########## @@ -244,14 +244,14 @@ class ImportExecutor(TaskExecutor): Storage ID: {self.storageId} Creator ID: {self.userId} """ - + info = f""" - ERROR: - the job was terminated due to an error that occurred + ERROR: + the job was terminated due to an error that occurred while importing the VOSpace nodes in the file catalog. - + This issue will be automatically reported to the administrator. - + """ msg += info m.setMessage("VOSpace import notification: Job ERROR", msg) @@ -288,7 +288,7 @@ class ImportExecutor(TaskExecutor): else: self.update("ERROR") try: - if destQueueLen == self.maxTerminatedJobs: + if destQueueLen >= self.maxTerminatedJobs: self.destQueue.extractJob() self.destQueue.insertJob(self.jobObj) self.srcQueue.extractJob()