im running jobs in GCP dataproc via airflow using gcp_dataproc_hook. before each job execution the hook using check if the job can be attached to a previously executed job.
when a job is attached dataprock dosn't execute the job unless i delete the previous (attached) job
due to this flow i loss a lot of meta and logs.
is there any way to disable the attachment?
this is the code in the hook that creates the attachment:
# There is a small set of states that we will accept as sufficient
# for attaching the new task instance to the old Dataproc job. We
# generally err on the side of _not_ attaching, unless the prior
# job is in a known-good state. For example, we don't attach to an
# ERRORed job because we want Airflow to be able to retry the job.
# The full set of possible states is here:
# https://cloud.google.com/dataproc/docs/reference/rest/v1beta2/projects.regions.jobs#State
recoverable_states = frozenset([
'PENDING',
'SETUP_DONE',
'RUNNING',
'DONE',
])
found_match = False
for job_on_cluster in jobs_on_cluster:
job_on_cluster_id = job_on_cluster['reference']['jobId']
job_on_cluster_task_id = job_on_cluster_id[:-UUID_LENGTH]
if task_id_to_submit == job_on_cluster_task_id:
self.job = job_on_cluster
self.job_id = self.job['reference']['jobId']
found_match = True
# We can stop looking once we find a matching job in a recoverable state.
if self.job['status']['state'] in recoverable_states:
break
if found_match and self.job['status']['state'] in recoverable_states:
message = """
Reattaching to previously-started DataProc job %s (in state %s).
If this is not the desired behavior (ie if you would like to re-run this job),
please delete the previous instance of the job by running:
gcloud --project %s dataproc jobs delete %s --region %s
"""