# Batch API . projects . locations . jobs . taskGroups . tasks

## Instance Methods

Close httplib2 connections.

Return a single Task.

List Tasks associated with a job.

Retrieves the next page of results.

### Method Details

`close()`

    Close httplib2 connections.

`get(name, x__xgafv=None)`

    Return a single Task.

    Args:
      name: string, Required. Task name. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A Cloud Batch task.
      "name": "A String", # Task name. The name is generated from the parent TaskGroup name and 'id' field. For example: "projects/123456/locations/us-west1/jobs/job01/taskGroups/group01/tasks/task01".
      "status": { # Status of a task. # Task Status.
        "state": "A String", # Task state.
        "statusEvents": [ # Detailed info about why the state is reached.
          { # Status event.
            "description": "A String", # Description of the event.
            "eventTime": "A String", # The time this event occurred.
            "taskExecution": { # This Task Execution field includes detail information for task execution procedures, based on StatusEvent types. # Task Execution. This field is only defined for task-level status events where the task fails.
              "exitCode": 42, # The exit code of a finished task. If the task succeeded, the exit code will be 0. If the task failed but not due to the following reasons, the exit code will be 50000. Otherwise, it can be from different sources: * Batch known failures: https://cloud.google.com/batch/docs/troubleshooting#reserved-exit-codes. * Batch runnable execution failures; you can rely on Batch logs to further diagnose: https://cloud.google.com/batch/docs/analyze-job-using-logs. If there are multiple runnables failures, Batch only exposes the first error.
            },
            "taskState": "A String", # Task State. This field is only defined for task-level status events.
            "type": "A String", # Type of the event.
          },
        ],
      },
    }

`list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)`

    List Tasks associated with a job.

    Args:
      parent: string, Required. Name of a TaskGroup from which Tasks are being requested. Pattern: "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}" (required)
      filter: string, Task filter, null filter matches all Tasks. Filter string should be of the format State=TaskStatus.State e.g. State=RUNNING
      pageSize: integer, Page size.
      pageToken: string, Page token.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # ListTasks Response.
      "nextPageToken": "A String", # Next page token.
      "tasks": [ # Tasks.
        { # A Cloud Batch task.
          "name": "A String", # Task name. The name is generated from the parent TaskGroup name and 'id' field. For example: "projects/123456/locations/us-west1/jobs/job01/taskGroups/group01/tasks/task01".
          "status": { # Status of a task. # Task Status.
            "state": "A String", # Task state.
            "statusEvents": [ # Detailed info about why the state is reached.
              { # Status event.
                "description": "A String", # Description of the event.
                "eventTime": "A String", # The time this event occurred.
                "taskExecution": { # This Task Execution field includes detail information for task execution procedures, based on StatusEvent types. # Task Execution. This field is only defined for task-level status events where the task fails.
                  "exitCode": 42, # The exit code of a finished task. If the task succeeded, the exit code will be 0. If the task failed but not due to the following reasons, the exit code will be 50000. Otherwise, it can be from different sources: * Batch known failures: https://cloud.google.com/batch/docs/troubleshooting#reserved-exit-codes. * Batch runnable execution failures; you can rely on Batch logs to further diagnose: https://cloud.google.com/batch/docs/analyze-job-using-logs. If there are multiple runnables failures, Batch only exposes the first error.
                },
                "taskState": "A String", # Task State. This field is only defined for task-level status events.
                "type": "A String", # Type of the event.
              },
            ],
          },
        },
      ],
      "unreachable": [ # Locations that could not be reached.
        "A String",
      ],
    }

`list_next()`

    Retrieves the next page of results.

            Args:
              previous_request: The request for the previous page. (required)
              previous_response: The response from the request for the previous page. (required)

            Returns:
              A request object that you can call 'execute()' on to request the next
              page. Returns None if there are no more items in the collection.