예제 #1
0
    def __init__(self,
                 job_name='{{task.task_id}}_{{ds_nodash}}',
                 cluster_name="cluster-1",
                 dataproc_properties=None,
                 dataproc_jars=None,
                 gcp_conn_id='google_cloud_default',
                 delegate_to=None,
                 labels=None,
                 region='global',
                 job_error_states=None,
                 *args,
                 **kwargs):
        super().__init__(*args, **kwargs)
        self.gcp_conn_id = gcp_conn_id
        self.delegate_to = delegate_to
        self.labels = labels
        self.job_name = job_name
        self.cluster_name = cluster_name
        self.dataproc_properties = dataproc_properties
        self.dataproc_jars = dataproc_jars
        self.region = region
        self.job_error_states = job_error_states if job_error_states is not None else {
            'ERROR'
        }

        self.hook = DataProcHook(gcp_conn_id=gcp_conn_id,
                                 delegate_to=delegate_to)
        self.job_template = None
        self.job = None
        self.dataproc_job_id = None
예제 #2
0
 def __init__(self,
              project_id,
              region='global',
              gcp_conn_id='google_cloud_default',
              delegate_to=None,
              *args,
              **kwargs):
     super().__init__(*args, **kwargs)
     self.gcp_conn_id = gcp_conn_id
     self.delegate_to = delegate_to
     self.project_id = project_id
     self.region = region
     self.hook = DataProcHook(gcp_conn_id=self.gcp_conn_id,
                              delegate_to=self.delegate_to,
                              api_version='v1beta2')
 def setUp(self):
     with mock.patch(BASE_STRING.format('GoogleCloudBaseHook.__init__'),
                     new=mock_init):
         self.dataproc_hook = DataProcHook()