def get_from_path_or_submission_lazy( submission_id, readonly: bool, db_path: Optional[str] = None, ): """ 2020-10-01 mfranklin: Probably the method you want to get a WorkflowManager from submissionID: :return: WorkflowManager of the submission_id (or THROWS) """ expanded_path = fully_qualify_filename(submission_id) if os.path.exists(expanded_path): return WorkflowManager.from_path_get_latest_manager( expanded_path, readonly=readonly ) return ConfigManager( db_path=db_path, readonly=True ).get_from_path_or_submission( submission_id=submission_id, readonly=readonly, perform_path_check=False )
def get_from_path_or_submission( self, submission_id, readonly: bool, perform_path_check=True ): if perform_path_check: expanded_path = fully_qualify_filename(submission_id) if os.path.exists(expanded_path): return WorkflowManager.from_path_get_latest_manager( expanded_path, readonly=readonly ) potential_submission = self.get_lazy_db_connection().get_by_id(submission_id) if potential_submission: return WorkflowManager.from_path_with_submission_id( potential_submission.execution_dir, submission_id=submission_id, readonly=readonly, ) raise Exception( f"Couldn't find task with id='{submission_id}', and no directory was found " )