batch

class moto.batch.models.BatchBackend(region_name: str, account_id: str)

Batch-jobs are executed inside a Docker-container. Everytime the submit_job-method is called, a new Docker container is started. A job is marked as ‘Success’ when the Docker-container exits without throwing an error.

Use @mock_batch_simple instead if you do not want to use a Docker-container. With this decorator, jobs are simply marked as ‘Success’ without trying to execute any commands/scripts.

Example usage

@mock_batch
def test_batch_behaviour:
    boto3.client("batch")
    ...

Implemented features for this service

  • [X] cancel_job

  • [X] create_compute_environment

  • [X] create_job_queue

  • [ ] create_scheduling_policy

  • [X] delete_compute_environment

  • [X] delete_job_queue

  • [ ] delete_scheduling_policy

  • [X] deregister_job_definition

  • [X] describe_compute_environments

    Pagination is not yet implemented

  • [X] describe_job_definitions

    Pagination is not yet implemented

  • [X] describe_job_queues

    Pagination is not yet implemented

  • [X] describe_jobs

  • [ ] describe_scheduling_policies

  • [X] list_jobs

    Pagination is not yet implemented

  • [ ] list_scheduling_policies

  • [X] list_tags_for_resource

  • [X] register_job_definition

  • [X] submit_job

    Parameters RetryStrategy and Parameters are not yet implemented.

  • [X] tag_resource

  • [X] terminate_job

  • [X] untag_resource

  • [X] update_compute_environment

  • [X] update_job_queue

  • [ ] update_scheduling_policy