Exemple #1
0
def download_execution_data(project: Project,
                            counters: Sequence[str]) -> Dict[str, dict]:
    executions = {}
    with click.progressbar(IntegerRange.parse(counters).as_set(),
                           label='fetching information') as counter_iter:
        for counter in counter_iter:
            execution = project.get_execution_from_counter(
                counter=counter, params={
                    'exclude': 'metadata,events,tags',
                })
            executions[execution['id']] = execution
    return executions
Exemple #2
0
def get_executions_for_stop(project: Project, counters: Optional[List[str]], *,
                            all: bool) -> List[dict]:
    params: Dict[str, Any] = {'project': project.id}
    if counters == ['latest']:
        return [project.get_execution_from_counter('latest')]

    if counters:
        params['counter'] = sorted(IntegerRange.parse(counters).as_set())
    elif all:
        params['status'] = 'incomplete'
    else:
        warn('Nothing to stop (pass #s or `--all`)')
        return []

    data = request('get', '/api/v0/executions/',
                   params=params).json()['results']
    assert isinstance(data, list)
    return data