def build_details(build_dir): """ Collect information from a build directory. Args: build_dir: GCS path containing a build's results. Returns: started: value from started.json {'version': ..., 'timestamp': ...} finished: value from finished.json {'timestamp': ..., 'result': ...} results: {total: int, failed: [(name, duration, text)...], skipped: [name...], passed: [name...]} """ started, finished, metadata = normalize_metadata( gcs_async.read(build_dir + '/started.json'), gcs_async.read(build_dir + '/finished.json') ) if started is None and finished is None: return started, finished, {}, None junit_paths = [f.filename for f in view_base.gcs_ls_recursive('%s/artifacts' % build_dir) if f.filename.endswith('.xml')] junit_futures = {f: gcs_async.read(f) for f in junit_paths} parser = JUnitParser() for path, future in junit_futures.iteritems(): parser.parse_xml(future.get_result(), path) return started, finished, metadata, parser.get_results()
def build_details(build_dir): """ Collect information from a build directory. Args: build_dir: GCS path containing a build's results. Returns: started: value from started.json {'version': ..., 'timestamp': ...} finished: value from finished.json {'timestamp': ..., 'result': ...} results: {total: int, failed: [(name, duration, text)...], skipped: [name...], passed: [name...]} """ started, finished = normalize_metadata( gcs_async.read(build_dir + '/started.json'), gcs_async.read(build_dir + '/finished.json') ) if started is None and finished is None: return started, finished, None junit_paths = [f.filename for f in view_base.gcs_ls_recursive('%s/artifacts' % build_dir) if f.filename.endswith('.xml')] junit_futures = {f: gcs_async.read(f) for f in junit_paths} parser = JUnitParser() for path, future in junit_futures.iteritems(): parser.parse_xml(future.get_result(), path) return started, finished, parser.get_results()
def build_details(build_dir): """ Collect information from a build directory. Args: build_dir: GCS path containing a build's results. Returns: started: value from started.json {'version': ..., 'timestamp': ...} finished: value from finished.json {'timestamp': ..., 'result': ...} results: {total: int, failed: [(name, duration, text)...], skipped: [name...], passed: [name...]} """ started_fut = gcs_async.read(build_dir + '/started.json') finished = gcs_async.read(build_dir + '/finished.json').get_result() started = started_fut.get_result() if finished and not started: started = 'null' if started and not finished: finished = 'null' elif not (started and finished): return started = json.loads(started) finished = json.loads(finished) junit_paths = [ f.filename for f in view_base.gcs_ls_recursive('%s/artifacts' % build_dir) if f.filename.endswith('.xml') ] junit_futures = {f: gcs_async.read(f) for f in junit_paths} parser = JUnitParser() for path, future in junit_futures.iteritems(): parser.parse_xml(future.get_result(), path) return started, finished, parser.get_results()