def __call__(self, config_stream: List[str], sampleinfo: str=None, sacct: str=None):
        """Add a new analysis log."""
        config_raw = ruamel.yaml.safe_load(config_stream)
        config_data = files_api.parse_config(config_raw)
        sampleinfo_path = Path(sampleinfo or config_data['sampleinfo_path'])
        if not sampleinfo_path.exists():
            raise MissingFileError(sampleinfo_path)
        with sampleinfo_path.open() as stream:
            sampleinfo_raw = ruamel.yaml.safe_load(stream)
        sampleinfo_data = files_api.parse_sampleinfo(sampleinfo_raw)
        sacct_path = Path(sacct if sacct else f"{config_data['log_path']}.status")
        if not sacct_path.exists():
            raise MissingFileError(sacct_path)
        with sacct_path.open() as stream:
            sacct_jobs = sacct_api.parse_sacct(stream)
        with Path(config_data['log_path']).open() as stream:
            jobs = len(miplog.job_ids(stream))
        run_data = self.parse(config_data, sampleinfo_data, sacct_jobs, jobs=jobs)
        self._delete_temp_logs(run_data['family'])
        new_run = self.build(run_data)
        if new_run:
            self.store.add_commit(new_run)
            return new_run
def __call__ ( self , config_stream : List [ str ] , sampleinfo : str = None , sacct : str = None ) : config_raw = ruamel . yaml . safe_load ( config_stream ) config_data = files_api . parse_config ( config_raw ) sampleinfo_path = Path ( sampleinfo or config_data [ 'sampleinfo_path' ] ) if not sampleinfo_path . exists ( ) : raise MissingFileError ( sampleinfo_path ) with sampleinfo_path . open ( ) as stream : sampleinfo_raw = ruamel . yaml . safe_load ( stream ) sampleinfo_data = files_api . parse_sampleinfo ( sampleinfo_raw ) sacct_path = Path ( sacct if sacct else f"{config_data['log_path']}.status" ) if not sacct_path . exists ( ) : raise MissingFileError ( sacct_path ) with sacct_path . open ( ) as stream : sacct_jobs = sacct_api . parse_sacct ( stream ) with Path ( config_data [ 'log_path' ] ) . open ( ) as stream : jobs = len ( miplog . job_ids ( stream ) ) run_data = self . parse ( config_data , sampleinfo_data , sacct_jobs , jobs = jobs ) self . _delete_temp_logs ( run_data [ 'family' ] ) new_run = self . build ( run_data ) if new_run : self . store . add_commit ( new_run ) return new_run
Add a new analysis log.