def await_pipeline_new_state(adapter: PachydermAdapter, pipeline_name, initial_state='starting', timeout=60): start_time = time.time() state = initial_state while state == initial_state and time.time() - start_time < timeout: time.sleep(1) pipelines = adapter.list_pipelines() state = pipelines.loc[pipelines.pipeline == pipeline_name, 'state'].iloc[0] return state
def test_list_pipelines(adapter: PachydermAdapter, pipeline_1, pipeline_2, pipeline_3, pipeline_4): df = adapter.list_pipelines() assert df.shape[0] >= 4 assert df.shape[1] == 15 assert all([c in df.columns for c in [ 'pipeline', 'image', 'cron_spec', 'input', 'input_repos', 'output_branch', 'parallelism_constant', 'parallelism_coefficient', 'datum_tries', 'max_queue_size', 'jobs_running', 'jobs_success', 'jobs_failure', 'created', 'state' ]]) assert set(df.loc[df['pipeline'] == 'test_pipeline_3', 'input_repos'].iloc[0]) == {'test_pipeline_1', 'test_pipeline_2'} assert df.loc[df['pipeline'] == 'test_pipeline_3', 'input'].iloc[0] == '(tick ∪ test_pipeline_1:* ∪ test_pipeline_2:*)' assert df.loc[df['pipeline'] == 'test_pipeline_3', 'cron_spec'].iloc[0] == '0 * * * *' assert set(df.loc[df['pipeline'] == 'test_pipeline_4', 'input_repos'].iloc[0]) == {'test_pipeline_1', 'test_pipeline_2'} assert df.loc[df['pipeline'] == 'test_pipeline_4', 'input'].iloc[0] == '(test_pipeline_1/test:* ⨯ test_pipeline_2/test:*)'