def _build_pipeline_request(self, task_view):
job_metadata = task_view.job_metadata<EOL>job_params = task_view.job_params<EOL>job_resources = task_view.job_resources<EOL>task_metadata = task_view.task_descriptors[<NUM_LIT:0>].task_metadata<EOL>task_params = task_view.task_descriptors[<NUM_LIT:0>].task_params<EOL>task_resources = task_view.task_descriptors[<NUM_LIT:0>].task_resources<EOL>mnt_datadisk = google_v2_pipelines.build_mount(<EOL>disk=_DATA_DISK_NAME,<EOL>path=providers_util.DATA_MOUNT_POINT,<EOL>read_only=False)<EOL>scopes = job_resources.scopes or google_base.DEFAULT_SCOPES<EOL>labels = {<EOL>label.name: label.value if label.value else '<STR_LIT>' for label in<EOL>google_base.build_pipeline_labels(job_metadata, task_metadata)<EOL>| job_params['<STR_LIT>'] | task_params['<STR_LIT>']<EOL>}<EOL>script = task_view.job_metadata['<STR_LIT>']<EOL>user_project = task_view.job_metadata['<STR_LIT>'] or '<STR_LIT>'<EOL>envs = job_params['<STR_LIT>'] | task_params['<STR_LIT>']<EOL>inputs = job_params['<STR_LIT>'] | task_params['<STR_LIT>']<EOL>outputs = job_params['<STR_LIT>'] | task_params['<STR_LIT>']<EOL>mounts = job_params['<STR_LIT>']<EOL>gcs_mounts = param_util.get_gcs_mounts(mounts)<EOL>persistent_disk_mount_params = param_util.get_persistent_disk_mounts(mounts)<EOL>persistent_disks = [<EOL>google_v2_pipelines.build_disk(<EOL>name=disk.name.replace('<STR_LIT:_>', '<STR_LIT:->'),  <EOL>size_gb=disk.disk_size or job_model.DEFAULT_MOUNTED_DISK_SIZE,<EOL>source_image=disk.value,<EOL>disk_type=disk.disk_type or job_model.DEFAULT_DISK_TYPE)<EOL>for disk in persistent_disk_mount_params<EOL>]<EOL>persistent_disk_mounts = [<EOL>google_v2_pipelines.build_mount(<EOL>disk=persistent_disk.get('<STR_LIT:name>'),<EOL>path=os.path.join(providers_util.DATA_MOUNT_POINT,<EOL>persistent_disk_mount_param.docker_path),<EOL>read_only=True)<EOL>for persistent_disk, persistent_disk_mount_param in zip(<EOL>persistent_disks, persistent_disk_mount_params)<EOL>]<EOL>optional_actions = <NUM_LIT:0><EOL>if job_resources.ssh:<EOL><INDENT>optional_actions += <NUM_LIT:1><EOL><DEDENT>mount_actions = self._get_mount_actions(gcs_mounts, mnt_datadisk)<EOL>optional_actions += len(mount_actions)<EOL>user_action = <NUM_LIT:4> + optional_actions<EOL>final_logging_action = <NUM_LIT:6> + optional_actions<EOL>logging_cmd = _LOGGING_CMD.format(<EOL>log_cp_fn=_GSUTIL_CP_FN,<EOL>log_cp_cmd=_LOG_CP_CMD.format(<EOL>user_action=user_action, logging_action='<STR_LIT>'))<EOL>continuous_logging_cmd = _CONTINUOUS_LOGGING_CMD.format(<EOL>log_msg_fn=_LOG_MSG_FN,<EOL>log_cp_fn=_GSUTIL_CP_FN,<EOL>log_cp_cmd=_LOG_CP_CMD.format(<EOL>user_action=user_action,<EOL>logging_action='<STR_LIT>'),<EOL>final_logging_action=final_logging_action,<EOL>log_interval=job_resources.log_interval or '<STR_LIT>')<EOL>logging_env = self._get_logging_env(task_resources.logging_path.uri,<EOL>user_project)<EOL>script_path = os.path.join(providers_util.SCRIPT_DIR, script.name)<EOL>prepare_command = _PREPARE_CMD.format(<EOL>log_msg_fn=_LOG_MSG_FN,<EOL>mk_runtime_dirs=_MK_RUNTIME_DIRS_CMD,<EOL>script_var=_SCRIPT_VARNAME,<EOL>python_decode_script=_PYTHON_DECODE_SCRIPT,<EOL>script_path=script_path,<EOL>mk_io_dirs=_MK_IO_DIRS)<EOL>prepare_env = self._get_prepare_env(script, task_view, inputs, outputs,<EOL>mounts)<EOL>localization_env = self._get_localization_env(inputs, user_project)<EOL>user_environment = self._build_user_environment(envs, inputs, outputs,<EOL>mounts)<EOL>delocalization_env = self._get_delocalization_env(outputs, user_project)<EOL>actions = []<EOL>actions.append(<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>flags='<STR_LIT>',<EOL>image_uri=_CLOUD_SDK_IMAGE,<EOL>environment=logging_env,<EOL>entrypoint='<STR_LIT>',<EOL>commands=['<STR_LIT:-c>', continuous_logging_cmd]))<EOL>if job_resources.ssh:<EOL><INDENT>actions.append(<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>image_uri=_SSH_IMAGE,<EOL>mounts=[mnt_datadisk],<EOL>entrypoint='<STR_LIT>',<EOL>port_mappings={_DEFAULT_SSH_PORT: _DEFAULT_SSH_PORT},<EOL>flags='<STR_LIT>'))<EOL><DEDENT>actions.append(<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>image_uri=_PYTHON_IMAGE,<EOL>mounts=[mnt_datadisk],<EOL>environment=prepare_env,<EOL>entrypoint='<STR_LIT>',<EOL>commands=['<STR_LIT:-c>', prepare_command]),)<EOL>actions.extend(mount_actions)<EOL>actions.extend([<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>image_uri=_CLOUD_SDK_IMAGE,<EOL>mounts=[mnt_datadisk],<EOL>environment=localization_env,<EOL>entrypoint='<STR_LIT>',<EOL>commands=[<EOL>'<STR_LIT:-c>',<EOL>_LOCALIZATION_CMD.format(<EOL>log_msg_fn=_LOG_MSG_FN,<EOL>recursive_cp_fn=_GSUTIL_RSYNC_FN,<EOL>cp_fn=_GSUTIL_CP_FN,<EOL>cp_loop=_LOCALIZATION_LOOP)<EOL>]),<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>image_uri=job_resources.image,<EOL>mounts=[mnt_datadisk] + persistent_disk_mounts,<EOL>environment=user_environment,<EOL>entrypoint='<STR_LIT>',<EOL>commands=[<EOL>'<STR_LIT>', '<STR_LIT:-c>',<EOL>_USER_CMD.format(<EOL>tmp_dir=providers_util.TMP_DIR,<EOL>working_dir=providers_util.WORKING_DIR,<EOL>user_script=script_path)<EOL>]),<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>image_uri=_CLOUD_SDK_IMAGE,<EOL>mounts=[mnt_datadisk],<EOL>environment=delocalization_env,<EOL>entrypoint='<STR_LIT>',<EOL>commands=[<EOL>'<STR_LIT:-c>',<EOL>_LOCALIZATION_CMD.format(<EOL>log_msg_fn=_LOG_MSG_FN,<EOL>recursive_cp_fn=_GSUTIL_RSYNC_FN,<EOL>cp_fn=_GSUTIL_CP_FN,<EOL>cp_loop=_DELOCALIZATION_LOOP)<EOL>]),<EOL>google_v2_pipelines.build_action(<EOL>name='<STR_LIT>',<EOL>flags='<STR_LIT>',<EOL>image_uri=_CLOUD_SDK_IMAGE,<EOL>environment=logging_env,<EOL>entrypoint='<STR_LIT>',<EOL>commands=['<STR_LIT:-c>', logging_cmd]),<EOL>])<EOL>assert len(actions) - <NUM_LIT:2> == user_action<EOL>assert len(actions) == final_logging_action<EOL>disks = [<EOL>google_v2_pipelines.build_disk(<EOL>_DATA_DISK_NAME,<EOL>job_resources.disk_size,<EOL>source_image=None,<EOL>disk_type=job_resources.disk_type or job_model.DEFAULT_DISK_TYPE)<EOL>]<EOL>disks.extend(persistent_disks)<EOL>network = google_v2_pipelines.build_network(<EOL>job_resources.network, job_resources.subnetwork,<EOL>job_resources.use_private_address)<EOL>if job_resources.machine_type:<EOL><INDENT>machine_type = job_resources.machine_type<EOL><DEDENT>elif job_resources.min_cores or job_resources.min_ram:<EOL><INDENT>machine_type = GoogleV2CustomMachine.build_machine_type(<EOL>job_resources.min_cores, job_resources.min_ram)<EOL><DEDENT>else:<EOL><INDENT>machine_type = job_model.DEFAULT_MACHINE_TYPE<EOL><DEDENT>accelerators = None<EOL>if job_resources.accelerator_type:<EOL><INDENT>accelerators = [<EOL>google_v2_pipelines.build_accelerator(job_resources.accelerator_type,<EOL>job_resources.accelerator_count)<EOL>]<EOL><DEDENT>service_account = google_v2_pipelines.build_service_account(<EOL>job_resources.service_account or '<STR_LIT:default>', scopes)<EOL>resources = google_v2_pipelines.build_resources(<EOL>self._project,<EOL>job_resources.regions,<EOL>google_base.get_zones(job_resources.zones),<EOL>google_v2_pipelines.build_machine(<EOL>network=network,<EOL>machine_type=machine_type,<EOL>preemptible=job_resources.preemptible,<EOL>service_account=service_account,<EOL>boot_disk_size_gb=job_resources.boot_disk_size,<EOL>disks=disks,<EOL>accelerators=accelerators,<EOL>nvidia_driver_version=job_resources.nvidia_driver_version,<EOL>labels=labels,<EOL>cpu_platform=job_resources.cpu_platform),<EOL>)<EOL>pipeline = google_v2_pipelines.build_pipeline(actions, resources, None,<EOL>job_resources.timeout)<EOL>return {'<STR_LIT>': pipeline, '<STR_LIT>': labels}<EOL>
Returns a Pipeline objects for the task.