diff --git a/autosubmit/autosubmit.py b/autosubmit/autosubmit.py index 0050026a809efd6d4908b1ab9a69f75b5100accb..f282733f0c8ea5d7a8ac9a6049efec2d3385e132 100644 --- a/autosubmit/autosubmit.py +++ b/autosubmit/autosubmit.py @@ -2126,6 +2126,7 @@ class Autosubmit: else: Log.debug("\nJobs prepared for {1}: {0}", len( job_list.get_prepared(platform)), platform.name) + job_list.update_list(as_conf, False) packages_to_submit = JobPackager( as_conf, platform, job_list, hold=hold).build_packages() if not inspect: @@ -2133,6 +2134,7 @@ class Autosubmit: valid_packages_to_submit = [] # type: List[JobPackageBase] for package in packages_to_submit: try: + # If called from inspect command or -cw if only_wrappers or inspect: if hasattr(package, "name"): @@ -2520,9 +2522,12 @@ class Autosubmit: job.children = job.children - referenced_jobs_to_remove job.parents = job.parents - referenced_jobs_to_remove - - Autosubmit.generate_scripts_andor_wrappers(as_conf, job_list_wrappers, jobs_wr, - packages_persistence, True) + try: + Autosubmit.generate_scripts_andor_wrappers(as_conf, job_list_wrappers, jobs_wr, + packages_persistence, True) + except AutosubmitCritical as e: + Log.printlog("Incomplete preview of wrappers",5000) + Log.printlog(e.message,7000) packages = packages_persistence.load(True) packages += JobPackagePersistence(os.path.join(BasicConfig.LOCAL_ROOT_DIR, expid, "pkl"), diff --git a/autosubmit/job/job.py b/autosubmit/job/job.py index ccda2ff843f08755a365ff713e74a92d841923a7..505d53c50a6cc0ba7a354d457d8429675e1ad052 100644 --- a/autosubmit/job/job.py +++ b/autosubmit/job/job.py @@ -1241,7 +1241,7 @@ class Job(object): template = '' if as_conf.get_remote_dependencies(): if self.type == Type.BASH: - template = 'sleep 360' + "\n" + template = 'sleep 1' + "\n" elif self.type == Type.PYTHON: template = 'time.sleep(5)' + "\n" elif self.type == Type.R: @@ -1250,7 +1250,7 @@ class Job(object): template_file.close() else: if self.type == Type.BASH: - template = 'sleep 360' + template = 'sleep 5' elif self.type == Type.PYTHON or self.type == Type.PYTHON2 or self.type == Type.PYTHON3: template = 'time.sleep(5)' elif self.type == Type.R: diff --git a/autosubmit/job/job_list.py b/autosubmit/job/job_list.py index f2fbe86d215878668cb8921fe0d540e54f122870..0ee972fa41d54be00c3941da107cb3d85595d24b 100644 --- a/autosubmit/job/job_list.py +++ b/autosubmit/job/job_list.py @@ -1210,7 +1210,6 @@ class JobList(object): :return: jobs in platforms :rtype: list """ - in_queue = self.get_submitted(platform) + self.get_running(platform) + self.get_queuing( platform) + self.get_unknown(platform) + self.get_held_jobs(platform) if wrapper: @@ -1504,6 +1503,15 @@ class JobList(object): def parameters(self, value): self._parameters = value + def check_possible_ready_jobs(self,job_list): + jobs = [ job for job in self.get_active() if job not in job_list ] + jobs += [ job for job in self.get_ready() if job not in job_list ] + for job in self.get_waiting(): + tmp = [parent for parent in job.parents if parent.status == Status.COMPLETED] + if len(tmp) == len(job.parents): + Log.debug("Job {0} is ready to run".format(job.name)) + jobs.append(job) + return list(set(jobs)) def update_list(self, as_conf, store_change=True, fromSetStatus=False, submitter=None, first_time=False): # type: (AutosubmitConfig, bool, bool, object, bool) -> bool """ diff --git a/autosubmit/job/job_packager.py b/autosubmit/job/job_packager.py index ea3e0b9f1ac5b8509020001cefd08083d5be42d4..9d664931e83333e2876a4aa90e8d461c6e457a66 100644 --- a/autosubmit/job/job_packager.py +++ b/autosubmit/job/job_packager.py @@ -449,7 +449,7 @@ class JobPackager(object): message += "\nCheck your configuration: Only jobs_in_wrappers are active, check their dependencies." if not balanced: message += "\nPackages are not well balanced: Check your dependencies(This is not the main cause of the Critical error)" - if len(self._jobs_list.get_in_queue()) == 0: + if len(self._jobs_list.check_possible_ready_jobs(p.jobs)) == 0: raise AutosubmitCritical(message, 7014) elif self.wrapper_policy[self.current_wrapper_section] == "mixed": error = True @@ -497,7 +497,8 @@ class JobPackager(object): message += "\nCheck your configuration: Only jobs_in_wrappers are active, check your jobs_in_wrapper dependencies." if not balanced: message += "\nPackages are not well balanced! (This is not the main cause of the Critical error)" - if len(self._jobs_list.get_in_queue()) == 0: # When there are not more posible jobs, autosubmit will stop the execution + if len(self._jobs_list.check_possible_ready_jobs(p.jobs)) == 0: # When there are not more posible jobs, autosubmit will stop the execution + raise AutosubmitCritical(message, 7014) else: for job in p.jobs: diff --git a/autosubmit/job/job_packages.py b/autosubmit/job/job_packages.py index 8e3c3409ac644e45bd7cba111c42faf4e9e0e51a..bd4972ddf1238d7323dd35f22512d5ca02cd5017 100644 --- a/autosubmit/job/job_packages.py +++ b/autosubmit/job/job_packages.py @@ -149,16 +149,18 @@ class JobPackageBase(object): try: # get one job of each section jobs by section if only_generate: - sections = configuration.get_wrapper_jobs(self.current_wrapper_section) - if "&" in sections: - sections.split("&") - elif " " in sections: - sections.split(" ") - else: - sections = [sections] - for section in sections: - if str(configuration._jobs_parser.get_option(section, "CHECK", 'True')).lower() == str(Job.CHECK_ON_SUBMISSION).lower(): - exit = True + # has self.current_wrapper_section attr + if hasattr(self, 'current_wrapper_section'): + sections = configuration.get_wrapper_jobs(self.current_wrapper_section) + if "&" in sections: + sections.split("&") + elif " " in sections: + sections.split(" ") + else: + sections = [sections] + for section in sections: + if str(configuration._jobs_parser.get_option(section, "CHECK", 'True')).lower() == str(Job.CHECK_ON_SUBMISSION).lower(): + exit = True if not exit: if len(self.jobs) < thread_number: for job in self.jobs: