def _submit_hadoop_job_resp(project=None, cluster=None, script_name=None, now=None):
 project = (project or _TEST_PROJECT)
 cluster = (cluster or _DATAPROC_CLUSTER)
 script_name = (script_name or _SCRIPT_NAME)
 now = (now or datetime.utcnow())
 job_elements = [script_name, _USER_NAME, now.strftime('%Y%m%d'), now.strftime('%H%M%S'), now.strftime('%f')]
 job_id = '-'.join((job_elements + ['-', 'Step', '1', 'of', '1']))
 dir_name = '.'.join(job_elements)
 mock_response = {'reference': {'projectId': project, 'jobId': job_id}, 'placement': {'clusterName': cluster, 'clusterUuid': '8b76d95e-ebdc-4b81-896d-b2c5009b3560'}, 'hadoopJob': {'mainJarFileUri': 'file:///usr/lib/hadoop-mapreduce/hadoop-streaming.jar', 'args': [], 'loggingConfig': {}}, 'status': {'state': 'PENDING', 'stateStartTime': _datetime_to_gcptime(now)}, 'driverControlFilesUri': ('gs://dataproc-801485be-0997-40e7-84a7-00926031747c-us/google-cloud-dataproc-metainfo/8b76d95e-ebdc-4b81-896d-b2c5009b3560/jobs/%(job_id)s/' % locals()), 'driverOutputResourceUri': ('gs://dataproc-801485be-0997-40e7-84a7-00926031747c-us/google-cloud-dataproc-metainfo/8b76d95e-ebdc-4b81-896d-b2c5009b3560/jobs/%(job_id)s/driveroutput' % locals())}
 return mock_response

def _submit_hadoop_job_resp ( project = None , cluster = None , script_name = None , now = None ) : project = ( project or _TEST_PROJECT ) cluster = ( cluster or _DATAPROC_CLUSTER ) script_name = ( script_name or _SCRIPT_NAME ) now = ( now or datetime . utcnow ( ) ) job_elements = [ script_name , _USER_NAME , now . strftime ( '%Y%m%d' ) , now . strftime ( '%H%M%S' ) , now . strftime ( '%f' ) ] job_id = '-' . join ( ( job_elements + [ '-' , 'Step' , '1' , 'of' , '1' ] ) ) dir_name = '.' . join ( job_elements ) mock_response = { 'reference' : { 'projectId' : project , 'jobId' : job_id } , 'placement' : { 'clusterName' : cluster , 'clusterUuid' : '8b76d95e-ebdc-4b81-896d-b2c5009b3560' } , 'hadoopJob' : { 'mainJarFileUri' : 'file:///usr/lib/hadoop-mapreduce/hadoop-streaming.jar' , 'args' : [ ] , 'loggingConfig' : { } } , 'status' : { 'state' : 'PENDING' , 'stateStartTime' : _datetime_to_gcptime ( now ) } , 'driverControlFilesUri' : ( 'gs://dataproc-801485be-0997-40e7-84a7-00926031747c-us/google-cloud-dataproc-metainfo/8b76d95e-ebdc-4b81-896d-b2c5009b3560/jobs/%(job_id)s/' % locals ( ) ) , 'driverOutputResourceUri' : ( 'gs://dataproc-801485be-0997-40e7-84a7-00926031747c-us/google-cloud-dataproc-metainfo/8b76d95e-ebdc-4b81-896d-b2c5009b3560/jobs/%(job_id)s/driveroutput' % locals ( ) ) } return mock_response
fake dataproc job metadata .