Beispiel #1
0
def _load_table_from_outputs(job_id, run_id, filename, client=None,
                             **table_kwargs):
    """Load a table from a run output directly into a ``DataFrame``"""
    client = APIClient(resources='all') if client is None else client
    file_id = cio.file_id_from_run_output(filename, job_id, run_id,
                                          client=client, regex=True)
    return cio.file_to_dataframe(file_id, client=client, **table_kwargs)
Beispiel #2
0
 def training_metadata(self):
     if self._train_metadata is None:
         fid = cio.file_id_from_run_output('model_info.json',
                                           self.train_job_id,
                                           self.train_run_id,
                                           client=self.client)
         self._train_metadata = cio.file_to_json(fid, client=self.client)
     return self._train_metadata
Beispiel #3
0
 def validation_metadata(self):
     if self._val_metadata is None:
         fid = cio.file_id_from_run_output('metrics.json',
                                           self.train_job_id,
                                           self.train_run_id,
                                           client=self.client)
         self._val_metadata = cio.file_to_json(fid, client=self.client)
     return self._val_metadata
Beispiel #4
0
def _retrieve_file(fname, job_id, run_id, local_dir, client=None):
    """Download a Civis file using a reference on a previous run"""
    file_id = cio.file_id_from_run_output(fname, job_id, run_id, client=client)
    fpath = os.path.join(local_dir, fname)
    # fname may contain a path
    output_dir = os.path.dirname(fpath)
    if not os.path.exists(output_dir):
        os.makedirs(output_dir)
    with open(fpath, 'wb') as down_file:
        cio.civis_to_file(file_id, down_file, client=client)
    return fpath