Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump job id and change output to /tmp/kfp/output #878

Merged
merged 3 commits into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def display_job_link(project_id, job):
))

def dump_job(job):
gcp_common.dump_file('/tmp/output/job.json', json.dumps(job))
gcp_common.dump_file('/tmp/kfp/output/dataflow/job.json', json.dumps(job))
gcp_common.dump_file('/tmp/kfp/output/dataflow/job_id.txt', job.get('id'))

def stage_file(local_or_gcs_path):
if not is_gcs_path(local_or_gcs_path):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def cancel():
launch_parameters['jobName'] = job_name
response = df_client.launch_template(project_id, gcs_path,
location, validate_only, launch_parameters)
job = response.get('job')
job = response.get('job', None)
if not job:
# Validate only mode
return job
return wait_and_dump_job(df_client, project_id, location, job,
wait_interval)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_launch_python_succeed(self, mock_subprocess, mock_process,
b'https://console.cloud.google.com/dataflow/locations/us-central1/jobs/job-1?project=project-1'
]
expected_job = {
'id': 'job-1',
'currentState': 'JOB_STATE_DONE'
}
mock_client().get_job.return_value = expected_job
Expand All @@ -56,6 +57,7 @@ def test_launch_python_retry_succeed(self, mock_subprocess, mock_process,
}]
}
expected_job = {
'id': 'job-1',
'currentState': 'JOB_STATE_DONE'
}
mock_client().get_job.return_value = expected_job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_launch_template_succeed(self, mock_client, mock_context, mock_display):
'job': { 'id': 'job-1' }
}
expected_job = {
'id': 'job-1',
'currentState': 'JOB_STATE_DONE'
}
mock_client().get_job.return_value = expected_job
Expand Down Expand Up @@ -64,6 +65,7 @@ def test_launch_template_retry_succeed(self,
'currentState': 'JOB_STATE_PENDING'
}
expected_job = {
'id': 'job-1',
'currentState': 'JOB_STATE_DONE'
}
mock_client().get_job.side_effect = [pending_job, expected_job]
Expand All @@ -89,6 +91,7 @@ def test_launch_template_fail(self, mock_client, mock_context, mock_display):
'job': { 'id': 'job-1' }
}
failed_job = {
'id': 'job-1',
'currentState': 'JOB_STATE_FAILED'
}
mock_client().get_job.return_value = failed_job
Expand Down