GitHubContribute in GitHub: Edit online

copyright: years: 2019 lastupdated: "2019-06-11"


Configuring batch jobs with Voice Agent Tester

You can create batch jobs to start and manage multiple current jobs. After you start multiple jobs at the same time, you can stop, pause, and unpause them.

  • Create a batch job for a particular worker by issuing a POST request similar to the following example:

    POST /voice-agent-tester/v1/worker/<worker-id>/batchJob?concurrent=<jobs_to_start>&jobsPerSecond=<jobs_to_start_per_second>
    
    • The concurrent value is an integer that indicates the number of jobs to start.
    • The jobsPerSecond value is an integer value that indicates the number of jobs to start per second. If the jobsPerSecond value isn't specified, all jobs start at the same time.

    A batch job groups the jobs by size and the number of jobs per second that was specified. The groups are started at one-second intervals.

  • Get the job status by issuing a GET request similar to the following example:

    GET /voice-agent-tester/v1/worker/<worker-id>/batchJob/<job-id>
    

The JSON object that is returned for a batch job request is similar to the following example: ``` { "id": "guid", "startTime": "timestamp", "stopTime": "timestamp", "status": "running", "concurrentJobs":1, "percentComplete": 45, "subJobs": [ { "id": "guid", "status": "running", "failures": 0 } ] }


### Batch job structure {: #batchj-struc}

The following table describes the batch job structure:

| Key | Description |
| -------------------- | -------------------- |
| ID | Specifies the GUID of the batch job. |
| status | Specifies the current [batch job status](#batchj-status). |
| startTime | Specifies the time stamp of when the batch job started running. |
| stopTime  | Specifies the time stamp of when the batch job finished, whether it finished successfully or failed. |
| concurrentJobs | Specifies the number of concurrent jobs that are running for the batch job. |
| percentComplete | Specifies the percentage of the batch job that completed. If you're running infinite iterations, this information isn't included.  |
| subJobs | Specifies an array of JSON objects, which contain a summary of the jobs that are managed by the batch job. You can get the full details of the job by entering a GET request for the job and including the ID of the job on the GET request. However, you can't start, stop, pause, unpause, or delete the job. The job must be managed through the batch job. |
{: caption="Table 1. Job structure" caption-side="top"}

### Batch job status {: #batchj-status}

The following table describes the possible status of a batch job:

| Status | Description |
| -------------------- | -------------------- |
| created | Specifies that the batch job was created. |
| starting | Specifies that the batch job is starting. |
| re-starting | Specifies that the batch job is running and that it starts when given the chance. |
| running | Specifies that the batch job is running.  |
| completed | Specifies that the batch job finished successfully. |
| failed | Specifies that the batch job exceeded the maximum number of failures to ignore, as defined in the failuresToIgnore key for the worker. |
| paused | Specifies that the batch job is paused. |
| pausing | Specifies that the batch job is in the process of pausing. |
| stopped  | Specifies that the batch job is stopped. |
| stopping  | Specifies that the batch job is stopping. |
| invalid | Specifies that the worker that was used for the batch job isn't valid, or that something went wrong in the call when the batch job was running. Maybe a test case that was used in the worker was deleted. |
{: caption="Table 2. Batch job status" caption-side="top"}

- Modify a running batch job without deleting the batch job.

  You can start, stop, pause, or unpause a running batch job without deleting the batch job.

  - Start a batch job, including the number of jobs to start per second.

  Use a PUT request with a start directive, similar to the following example:
  ```
  PUT /voice-agent-tester/v1/worker/<worker-id>/batchJob/<job-id>/start?jobsPerSecond=<jobs_to_start_per_second>
  ```
  - Stop a batch job.

  Issue a PUT request with the stop directive, similar to the following example:
  ```
  PUT /voice-agent-tester/v1/worker/<worker-id>/batchJob/<job-id>/stop
  ```
  - Pause a job.

  Issue a PUT request with the pause directive, similar to the following example:
  ```
  PUT /voice-agent-tester/v1/worker/<worker-id>/batchJob/<job-id>/pause
  ```  

  - Unpause a batch job, including the number of jobs to start per second.

  Issue a PUT request with the unpause directive, similar to the following example:
  ```
  PUT /voice-agent-tester/v1/worker/<worker-id>/batchJob/<job-id>/unpause?jobsPerSecond=<jobs_to_start_per_second>
  ```  

  The following table describes the directives that you can use to modify a running batch job:

| Directive | Description |
| -------------------- | -------------------- |
| stop | Specifies that the actively running test is stopped for all subjobs, and that the current data is reset. |
| start | Specifies that if the batch job isn't running, the results for the subjobs are cleared, and the subjobs are started from the beginning. If the batch job is running, the results for the subjobs are also cleared, and all the subjobs are started from the beginning. You can specify the `jobsPerSecond` value on the start directive. However, if the subjobs are running the `jobsPerSecond` value has no effect. |
| pause | Specifies that the currently running test for all subjobs completes. Then, the subjobs are paused before the next test case is run. |
| unpause | Specifies that all the subjobs are started at the test case and iteration where the subjobs were paused. If you specify the `jobsPerSecond` value, the batch job each second unpauses the subjobs. These subjobs are grouped based on the size of each subjob and the `jobsPerSecond` value. |
{: caption="Table 3. Directives for a running batch job" caption-side="top"}

- Delete all subjobs of the batch job by using a DELETE request similar to the following example:

  ```
DELETE /voice-agent-tester/v1/worker/<worker-id>/batchJob/<job-id>
**Important** All accumulated job data is deleted and can't be recovered.
  • Delete all batch jobs associated with a specific worker by using a DELETE request similar to the following example:

    DELETE /voice-agent-tester/v1/worker/<worker-id>/batchJob
    

    Important All accumulated job data is deleted and can't be recovered.