Exemple #1
0
def init_run_output(path, wa_state, force=False):
    if os.path.exists(path):
        if force:
            logger.info('Removing existing output directory.')
            shutil.rmtree(os.path.abspath(path))
        else:
            raise RuntimeError('path exists: {}'.format(path))

    logger.info('Creating output directory.')
    os.makedirs(path)
    meta_dir = os.path.join(path, '__meta')
    os.makedirs(meta_dir)
    _save_raw_config(meta_dir, wa_state)
    touch(os.path.join(path, 'run.log'))

    info = RunInfo(
        run_name=wa_state.run_config.run_name,
        project=wa_state.run_config.project,
        project_stage=wa_state.run_config.project_stage,
    )
    write_pod(info.to_pod(), os.path.join(meta_dir, 'run_info.json'))
    write_pod(RunState().to_pod(), os.path.join(path, '.run_state.json'))
    write_pod(Result().to_pod(), os.path.join(path, 'result.json'))

    ro = RunOutput(path)
    ro.update_metadata('versions', 'wa', get_wa_version_with_commit())
    ro.update_metadata('versions', 'devlib', devlib.__full_version__)

    return ro
 def write_log(self, outfile):
     with self.lock:
         self.poll()
         if os.path.isfile(self.buffer_file):
             shutil.copy(self.buffer_file, outfile)
         else:  # there was no logcat trace at this time
             touch(outfile)
 def write_log(self, outfile):
     with self.lock:
         self.poll()
         if os.path.isfile(self.buffer_file):
             shutil.copy(self.buffer_file, outfile)
         else:  # there was no logcat trace at this time
             touch(outfile)
 def clear_buffer(self):
     self.logger.debug('Clearing logcat buffer')
     with self.lock:
         self.target.clear_logcat()
         touch(self.buffer_file)
 def clear_buffer(self):
     self.logger.debug('Clearing logcat buffer')
     with self.lock:
         self.target.clear_logcat()
         touch(self.buffer_file)