| Title: | A Crew Launcher Plugin for AWS Batch | 
| Description: | In computationally demanding analysis projects, statisticians and data scientists asynchronously deploy long-running tasks to distributed systems, ranging from traditional clusters to cloud services. The 'crew.aws.batch' package extends the 'mirai'-powered 'crew' package with a worker launcher plugin for AWS Batch. Inspiration also comes from packages 'mirai' by Gao (2023) https://github.com/r-lib/mirai, 'future' by Bengtsson (2021) <doi:10.32614/RJ-2021-048>, 'rrq' by FitzJohn and Ashton (2023) https://github.com/mrc-ide/rrq, 'clustermq' by Schubert (2019) <doi:10.1093/bioinformatics/btz284>), and 'batchtools' by Lang, Bischl, and Surmann (2017). <doi:10.21105/joss.00135>. | 
| Version: | 0.1.0 | 
| License: | MIT + file LICENSE | 
| URL: | https://wlandau.github.io/crew.aws.batch/, https://github.com/wlandau/crew.aws.batch | 
| BugReports: | https://github.com/wlandau/crew.aws.batch/issues | 
| Depends: | R (≥ 4.0.0) | 
| Imports: | cli (≥ 3.1.0), crew (≥ 1.3.0), paws.common (≥ 0.7.0), paws.compute, paws.management, R6, rlang, tibble, utils | 
| Suggests: | knitr (≥ 1.30), markdown (≥ 1.1), rmarkdown (≥ 2.4), testthat (≥ 3.0.0) | 
| Encoding: | UTF-8 | 
| Language: | en-US | 
| Config/testthat/edition: | 3 | 
| RoxygenNote: | 7.3.3 | 
| NeedsCompilation: | no | 
| Packaged: | 2025-09-15 12:31:28 UTC; C240390 | 
| Author: | William Michael Landau | 
| Maintainer: | William Michael Landau <will.landau.oss@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-09-15 12:50:09 UTC | 
crew.aws.batch: a crew launcher plugin for AWS Batch
Description
In computationally demanding analysis projects,
statisticians and data scientists asynchronously
deploy long-running tasks to distributed systems,
ranging from traditional clusters to cloud services.
The crew.aws.batch package extends the
mirai-powered
crew package with worker
launcher plugins for AWS Batch.
Inspiration also comes from packages
mirai,
future,
rrq,
clustermq,
and batchtools.
Terminate an AWS Batch job.
Description
Not a user-side function. For internal use only.
Usage
crew_aws_batch_job_name(name)
Arguments
| name | Character string, an AWS Batch job name, possibly invalid. | 
Value
Character string, a valid AWS Batch job name.
AWS Batch definition class
Description
AWS Batch definition R6 class
Details
See crew_definition_aws_batch().
IAM policies
In order for the AWS Batch crew job definition class to function
properly, your IAM policy needs permission to perform the
RegisterJobDefinition, DeregisterJobDefinition, and
DescribeJobDefinitions AWS Batch API calls.
For more information on AWS policies and permissions, please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
Active bindings
- job_queue
- job_definition
- log_group
- config
- credentials
- endpoint
- region
Methods
Public methods
Method new()
AWS Batch job definition constructor.
Usage
crew_class_definition_aws_batch$new( job_queue = NULL, job_definition = NULL, log_group = NULL, config = NULL, credentials = NULL, endpoint = NULL, region = NULL )
Arguments
- job_queue
- job_definition
- log_group
- config
- credentials
- endpoint
- region
Returns
AWS Batch job definition object.
Method validate()
Validate the object.
Usage
crew_class_definition_aws_batch$validate()
Returns
NULL (invisibly). Throws an error if a field is invalid.
Method register()
Register a job definition.
Usage
crew_class_definition_aws_batch$register( image, platform_capabilities = "EC2", memory_units = "gigabytes", memory = NULL, cpus = NULL, gpus = NULL, seconds_timeout = NULL, scheduling_priority = NULL, tags = NULL, propagate_tags = NULL, parameters = NULL, job_role_arn = NULL, execution_role_arn = NULL )
Arguments
- image
- Character of length 1, Docker image used for each job. You can supply a path to an image in Docker Hub or the full URI of an image in an Amazon ECR repository. 
- platform_capabilities
- Optional character of length 1, either - "EC2"to run on EC2 or- "FARGATE"to run on Fargate.
- memory_units
- Character of length 1, either - "gigabytes"or- "mebibytes"to set the units of the- memoryargument.- "gigabytes"is simpler for EC2 jobs, but Fargate has strict requirements about specifying exact amounts of mebibytes (MiB). for details, read https://docs.aws.amazon.com/cli/latest/reference/batch/register-job-definition.html # nolint
- memory
- Positive numeric of length 1, amount of memory to request for each job. 
- cpus
- Positive numeric of length 1, number of virtual CPUs to request for each job. 
- gpus
- Positive numeric of length 1, number of GPUs to request for each job. 
- seconds_timeout
- Optional positive numeric of length 1, number of seconds until a job times out. 
- scheduling_priority
- Optional nonnegative integer of length 1 between - 0and- 9999, priority of jobs. Jobs with higher-valued priorities are scheduled first. The priority only applies if the job queue has a fair share policy. Set to- NULLto omit.
- tags
- Optional character vector of tags. 
- propagate_tags
- Optional logical of length 1, whether to propagate tags from the job or definition to the ECS task. 
- parameters
- Optional character vector of key-value pairs designating parameters for job submission. 
- job_role_arn
- Character of length 1, Amazon resource name (ARN) of the job role. 
- execution_role_arn
- Character of length 1, Amazon resource name (ARN) of the execution role. 
Details
The register() method registers a simple
job definition using the job definition name and log group originally
supplied to crew_definition_aws_batch().
Job definitions created with $register() are container-based
and use the AWS log driver.
For more complicated
kinds of jobs, we recommend skipping register(): first call
https://www.paws-r-sdk.com/docs/batch_register_job_definition/
to register the job definition, then supply the job definition
name to the job_definition argument of crew_definition_aws_batch().
Returns
A one-row tibble with the job definition name, ARN, and
revision number of the registered job definition.
Method deregister()
Attempt to deregister a revision of the job definition.
Usage
crew_class_definition_aws_batch$deregister(revision = NULL)
Arguments
- revision
- Finite positive integer of length 1, optional revision number to deregister. If - NULL, then only the highest revision number of the job definition is deregistered, if it exists.
Details
Attempt to deregister the job definition whose name was
originally supplied to the job_definition argument of
crew_definition_aws_batch().
Returns
NULL (invisibly).
Method describe()
Describe the revisions of the job definition.
Usage
crew_class_definition_aws_batch$describe(revision = NULL, active = FALSE)
Arguments
- revision
- Positive integer of length 1, optional revision number to describe. 
- active
- Logical of length 1, whether to filter on just the active job definition. 
Returns
A tibble with job definition information.
There is one row per revision.
Some fields may be nested lists.
Method submit()
Submit an AWS Batch job with the given job definition.
Usage
crew_class_definition_aws_batch$submit(
  command = c("sleep", "300"),
  name = paste0("crew-aws-batch-job-", crew::crew_random_name()),
  cpus = NULL,
  gpus = NULL,
  memory_units = "gigabytes",
  memory = NULL,
  seconds_timeout = NULL,
  share_identifier = NULL,
  scheduling_priority_override = NULL,
  tags = NULL,
  propagate_tags = NULL,
  parameters = NULL
)Arguments
- command
- Character vector with the command to submit for the job. Usually a Linux shell command with each term in its own character string. 
- name
- Character of length 1 with the job name. 
- cpus
- Positive numeric of length 1, number of virtual CPUs to request for each job. 
- gpus
- Positive numeric of length 1, number of GPUs to request for each job. 
- memory_units
- Character of length 1, either - "gigabytes"or- "mebibytes"to set the units of the- memoryargument.- "gigabytes"is simpler for EC2 jobs, but Fargate has strict requirements about specifying exact amounts of mebibytes (MiB). for details, read https://docs.aws.amazon.com/cli/latest/reference/batch/register-job-definition.html # nolint
- memory
- Positive numeric of length 1, amount of memory to request for each job. 
- seconds_timeout
- Optional positive numeric of length 1, number of seconds until a job times out. 
- share_identifier
- Character of length 1 with the share identifier of the job. Only applies if the job queue has a scheduling policy. Read the official AWS Batch documentation for details. 
- scheduling_priority_override
- Optional nonnegative integer of length between - 0and- 9999, priority of the job. This value overrides the priority in the job definition. Jobs with higher-valued priorities are scheduled first. The priority applies if the job queue has a fair share policy. Set to- NULLto omit.
- tags
- Optional character vector of tags. 
- propagate_tags
- Optional logical of length 1, whether to propagate tags from the job or definition to the ECS task. 
- parameters
- Optional character vector of key-value pairs designating parameters for job submission. 
Details
This method uses the job queue and job definition
that were supplied through crew_definition_aws_batch().
Any jobs submitted this way are different from the
crew workers that the crew controller starts automatically
using the AWS Batch launcher plugin.
You may use the submit() method in the definition for different
purposes such as testing.
Returns
A one-row tibble with the name, ID, and
Amazon resource name (ARN) of the job.
See Also
Other definition: 
crew_definition_aws_batch()
AWS Batch launcher class
Description
AWS Batch launcher R6 class
Details
See crew_launcher_aws_batch().
IAM policies
In order for the AWS Batch crew plugin to function properly, your IAM
policy needs permission to perform the SubmitJob and TerminateJob
AWS Batch API calls. For more information on AWS policies and permissions,
please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
AWS arguments
The AWS Batch controller and launcher accept many arguments
which start with "aws_batch_". These arguments are AWS-Batch-specific
parameters forwarded directly to the submit_job() method for
the Batch client in the paws.compute R package
For a full description of each argument, including its meaning and format, please visit https://www.paws-r-sdk.com/docs/batch_submit_job/. The upstream API documentation is at https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html and the analogous CLI documentation is at https://docs.aws.amazon.com/cli/latest/reference/batch/submit-job.html.
The actual argument names may vary slightly, depending
on which : for example, the aws_batch_job_definition argument of
the crew AWS Batch launcher/controller corresponds to the
jobDefinition argument of the web API and
paws.compute::batch()$submit_job(), and both correspond to the
--job-definition argument of the CLI.
Verbosity
Control verbosity with the paws.log_level global option in R.
Set to 0 for minimum verbosity and 3 for maximum verbosity.
Super class
crew::crew_class_launcher -> crew_class_launcher_aws_batch
Active bindings
- options_aws_batch
Methods
Public methods
Inherited methods
- crew::crew_class_launcher$call()
- crew::crew_class_launcher$crashes()
- crew::crew_class_launcher$launch()
- crew::crew_class_launcher$launch_worker()
- crew::crew_class_launcher$poll()
- crew::crew_class_launcher$scale()
- crew::crew_class_launcher$set_name()
- crew::crew_class_launcher$settings()
- crew::crew_class_launcher$start()
- crew::crew_class_launcher$terminate()
- crew::crew_class_launcher$terminate_workers()
Method new()
Abstract launcher constructor.
Usage
crew_class_launcher_aws_batch$new( name = NULL, workers = NULL, seconds_interval = NULL, seconds_timeout = NULL, seconds_launch = NULL, seconds_idle = NULL, seconds_wall = NULL, tasks_max = NULL, tasks_timers = NULL, reset_globals = NULL, reset_packages = NULL, reset_options = NULL, garbage_collection = NULL, tls = NULL, processes = NULL, r_arguments = NULL, options_metrics = NULL, options_aws_batch = NULL )
Arguments
- name
- workers
- seconds_interval
- seconds_timeout
- seconds_launch
- seconds_idle
- seconds_wall
- tasks_max
- tasks_timers
- reset_globals
- Deprecated. See - crew_launcher_aws_batch().
- reset_packages
- Deprecated. See - crew_launcher_aws_batch().
- reset_options
- Deprecated. See - crew_launcher_aws_batch().
- garbage_collection
- Deprecated. See - crew_launcher_aws_batch().
- tls
- processes
- r_arguments
- options_metrics
- options_aws_batch
Returns
An abstract launcher object.
Method validate()
Validate the launcher.
Usage
crew_class_launcher_aws_batch$validate()
Returns
NULL (invisibly). Throws an error if a field is invalid.
Method launch_workers()
Launch a local process worker which will dial into a socket.
Usage
crew_class_launcher_aws_batch$launch_workers(call, n)
Arguments
- call
- Character string, a namespaced call to - crew::crew_worker()which will run in the worker and accept tasks.
- n
- Integer of length 1, number of workers to launch in the array job for the current round of auto-scaling. 
Details
The call argument is R code that will run to
initiate the worker.
Returns
A handle object to allow the termination of the worker later on.
See Also
Other plugin_aws_batch: 
crew_controller_aws_batch(),
crew_launcher_aws_batch()
AWS Batch monitor class
Description
AWS Batch monitor R6 class
Details
IAM policies
In order for the AWS Batch crew monitor class to function
properly, your IAM policy needs permission to perform the SubmitJob,
TerminateJob, ListJobs, and DescribeJobs AWS Batch API calls.
In addition, to download CloudWatch logs with the log() method,
your IAM policy also needs permission to perform the GetLogEvents
CloudWatch logs API call.
For more information on AWS policies and permissions, please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
Active bindings
- job_queue
- job_definition
- log_group
- config
- credentials
- endpoint
- region
Methods
Public methods
Method new()
AWS Batch job definition constructor.
Usage
crew_class_monitor_aws_batch$new( job_queue = NULL, job_definition = NULL, log_group = NULL, config = NULL, credentials = NULL, endpoint = NULL, region = NULL )
Arguments
- job_queue
- job_definition
- log_group
- config
- credentials
- endpoint
- region
Returns
AWS Batch job definition object.
Method validate()
Validate the object.
Usage
crew_class_monitor_aws_batch$validate()
Returns
NULL (invisibly). Throws an error if a field is invalid.
Method terminate()
Terminate one or more AWS Batch jobs.
Usage
crew_class_monitor_aws_batch$terminate( ids = NULL, all = FALSE, reason = "cancelled/terminated by crew.aws.batch monitor", verbose = TRUE )
Arguments
- ids
- Character vector with the IDs of the AWS Batch jobs to terminate. Leave as - NULLif- allis- TRUE.
- all
- TRUEto terminate all jobs belonging to the previously specified job definition.- FALSEto terminate only the job IDs given in the- idsargument.
- reason
- Character of length 1, natural language explaining the reason the job was terminated. 
- verbose
- Logical of length 1, whether to show a progress bar if the R process is interactive and - length(ids)is greater than 1.
Returns
NULL (invisibly).
Method status()
Get the status of a single job
Usage
crew_class_monitor_aws_batch$status(id)
Arguments
- id
- Character of length 1, job ID. This is different from the user-supplied job name. 
Returns
A one-row tibble with information about the job.
Method log()
Get the CloudWatch log of a job.
Usage
crew_class_monitor_aws_batch$log(id, path = stdout(), start_from_head = FALSE)
Arguments
- id
- Character of length 1, job ID. This is different from the user-supplied job name. 
- path
- Character string or stream (e.g. - stdout()), file path or connection passed to the- conargument of- writeLines()to print the log messages. Set to- nullfile()to suppress output (and use the invisibly returned- tibbleobject instead).
- start_from_head
- Logical of length 1, whether to print earlier log events before later ones. 
Details
This method assumes the job has log driver "awslogs"
(specifying AWS CloudWatch) and that the log group is the one
prespecified in the log_group argument of
crew_monitor_aws_batch(). This method cannot use
other log drivers such as Splunk, and it will fail if the log
group is wrong or missing.
Returns
log() invisibly returns a tibble with log information
and writes the messages to the stream or path given by the
path argument.
Method jobs()
List all the jobs in the given job queue with the given job definition.
Usage
crew_class_monitor_aws_batch$jobs(
  status = c("submitted", "pending", "runnable", "starting", "running", "succeeded",
    "failed")
)Arguments
- status
- Character vector of job states. Results are limited to these job states. 
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method active()
List active jobs: submitted, pending, runnable, starting, or running (not succeeded or failed).
Usage
crew_class_monitor_aws_batch$active()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method inactive()
List inactive jobs: ones whose status is succeeded or failed (not submitted, pending, runnable, starting, or running).
Usage
crew_class_monitor_aws_batch$inactive()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method submitted()
List jobs whose status is "submitted".
Usage
crew_class_monitor_aws_batch$submitted()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method pending()
List jobs whose status is "pending".
Usage
crew_class_monitor_aws_batch$pending()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method runnable()
List jobs whose status is "runnable".
Usage
crew_class_monitor_aws_batch$runnable()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method starting()
List jobs whose status is "starting".
Usage
crew_class_monitor_aws_batch$starting()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method running()
List jobs whose status is "running".
Usage
crew_class_monitor_aws_batch$running()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method succeeded()
List jobs whose status is "succeeded".
Usage
crew_class_monitor_aws_batch$succeeded()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
Method failed()
List jobs whose status is "failed".
Usage
crew_class_monitor_aws_batch$failed()
Details
The output only includes jobs under the
job queue and job definition
that were supplied through crew_monitor_aws_batch().
Returns
A tibble with one row per job and columns
with job information.
See Also
Other monitor: 
crew_monitor_aws_batch()
Create a controller with an AWS Batch launcher.
Description
Create an R6 object to submit tasks and
launch workers on AWS Batch workers.
Usage
crew_controller_aws_batch(
  name = NULL,
  workers = 1L,
  host = NULL,
  port = NULL,
  tls = crew::crew_tls(mode = "automatic"),
  tls_enable = NULL,
  tls_config = NULL,
  serialization = NULL,
  profile = crew::crew_random_name(),
  seconds_interval = 0.5,
  seconds_timeout = 60,
  seconds_launch = 1800,
  seconds_idle = 300,
  seconds_wall = Inf,
  retry_tasks = NULL,
  tasks_max = Inf,
  tasks_timers = 0L,
  reset_globals = TRUE,
  reset_packages = FALSE,
  reset_options = FALSE,
  garbage_collection = FALSE,
  crashes_error = NULL,
  processes = NULL,
  r_arguments = c("--no-save", "--no-restore"),
  crashes_max = 5L,
  backup = NULL,
  options_metrics = crew::crew_options_metrics(),
  options_aws_batch = crew.aws.batch::crew_options_aws_batch(),
  aws_batch_config = NULL,
  aws_batch_credentials = NULL,
  aws_batch_endpoint = NULL,
  aws_batch_region = NULL,
  aws_batch_job_definition = NULL,
  aws_batch_job_queue = NULL,
  aws_batch_share_identifier = NULL,
  aws_batch_scheduling_priority_override = NULL,
  aws_batch_parameters = NULL,
  aws_batch_container_overrides = NULL,
  aws_batch_node_overrides = NULL,
  aws_batch_retry_strategy = NULL,
  aws_batch_propagate_tags = NULL,
  aws_batch_timeout = NULL,
  aws_batch_tags = NULL,
  aws_batch_eks_properties_override = NULL
)
Arguments
| name | Character string, name of the launcher. If the name is
 | 
| workers | Maximum number of workers to run concurrently
when auto-scaling, excluding task retries and manual calls to  | 
| host | IP address of the  | 
| port | TCP port to listen for the workers. If  | 
| tls | A TLS configuration object from  | 
| tls_enable | Deprecated on 2023-09-15 in version 0.4.1.
Use argument  | 
| tls_config | Deprecated on 2023-09-15 in version 0.4.1.
Use argument  | 
| serialization | Either  | 
| profile | Character string, compute profile for  | 
| seconds_interval | Number of seconds between
polling intervals waiting for certain internal
synchronous operations to complete. In certain cases, exponential
backoff is used with this argument passed to  | 
| seconds_timeout | Number of seconds until timing
out while waiting for certain synchronous operations to complete,
such as checking  | 
| seconds_launch | Seconds of startup time to allow.
A worker is unconditionally assumed to be alive
from the moment of its launch until  | 
| seconds_idle | Maximum number of seconds that a worker can idle
since the completion of the last task. If exceeded, the worker exits.
But the timer does not launch until  | 
| seconds_wall | Soft wall time in seconds.
The timer does not launch until  | 
| retry_tasks | Deprecated on 2025-01-13 ( | 
| tasks_max | Maximum number of tasks that a worker will do before exiting. Also determines how often the controller auto-scales. See the Auto-scaling section for details. | 
| tasks_timers | Number of tasks to do before activating
the timers for  | 
| reset_globals | 
 | 
| reset_packages | 
 | 
| reset_options | 
 | 
| garbage_collection | 
 | 
| crashes_error | Deprecated on 2025-01-13 ( | 
| processes | Deprecated on 2025-08-27 ( | 
| r_arguments | Optional character vector of command line arguments
to pass to  | 
| crashes_max | In rare cases, a worker may exit unexpectedly
before it completes its current task. If this happens,  
 | 
| backup | An optional  Limitations of  | 
| options_metrics | Either  | 
| options_aws_batch | List of options from  | 
| aws_batch_config | Deprecated.
Use  | 
| aws_batch_credentials | Deprecated.
Use  | 
| aws_batch_endpoint | Deprecated.
Use  | 
| aws_batch_region | Deprecated.
Use  | 
| aws_batch_job_definition | Deprecated.
Use  | 
| aws_batch_job_queue | Deprecated.
Use  | 
| aws_batch_share_identifier | Deprecated.
Use  | 
| aws_batch_scheduling_priority_override | Deprecated.
Use  | 
| aws_batch_parameters | Deprecated.
Use  | 
| aws_batch_container_overrides | Deprecated.
Use  | 
| aws_batch_node_overrides | Deprecated.
Use  | 
| aws_batch_retry_strategy | Deprecated.
Use  | 
| aws_batch_propagate_tags | Deprecated.
Use  | 
| aws_batch_timeout | Deprecated.
Use  | 
| aws_batch_tags | Deprecated.
Use  | 
| aws_batch_eks_properties_override | Deprecated.
Use  | 
IAM policies
In order for the AWS Batch crew plugin to function properly, your IAM
policy needs permission to perform the SubmitJob and TerminateJob
AWS Batch API calls. For more information on AWS policies and permissions,
please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
AWS arguments
The AWS Batch controller and launcher accept many arguments
which start with "aws_batch_". These arguments are AWS-Batch-specific
parameters forwarded directly to the submit_job() method for
the Batch client in the paws.compute R package
For a full description of each argument, including its meaning and format, please visit https://www.paws-r-sdk.com/docs/batch_submit_job/. The upstream API documentation is at https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html and the analogous CLI documentation is at https://docs.aws.amazon.com/cli/latest/reference/batch/submit-job.html.
The actual argument names may vary slightly, depending
on which : for example, the aws_batch_job_definition argument of
the crew AWS Batch launcher/controller corresponds to the
jobDefinition argument of the web API and
paws.compute::batch()$submit_job(), and both correspond to the
--job-definition argument of the CLI.
Verbosity
Control verbosity with the paws.log_level global option in R.
Set to 0 for minimum verbosity and 3 for maximum verbosity.
See Also
Other plugin_aws_batch: 
crew_class_launcher_aws_batch,
crew_launcher_aws_batch()
Examples
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
controller <- crew_controller_aws_batch(
  aws_batch_job_definition = "YOUR_JOB_DEFINITION_NAME",
  aws_batch_job_queue = "YOUR_JOB_QUEUE_NAME"
)
controller$start()
controller$push(name = "task", command = sqrt(4))
controller$wait()
controller$pop()$result
controller$terminate()
}
Create an AWS Batch job definition object.
Description
Create an R6 object to manage a job definition for AWS
Batch jobs.
Usage
crew_definition_aws_batch(
  job_queue,
  job_definition = paste0("crew-aws-batch-job-definition-", crew::crew_random_name()),
  log_group = "/aws/batch/job",
  config = NULL,
  credentials = NULL,
  endpoint = NULL,
  region = NULL
)
Arguments
| job_queue | Character vector of names of AWS Batch job queues.
As of  | 
| job_definition | Character of length 1, name of the AWS Batch
job definition. The job definition might or might not exist
at the time  | 
| log_group | Character of length 1,
AWS Batch CloudWatch log group to get job logs.
The default log group is often  | 
| config | Optional named list,  | 
| credentials | Optional named list.  | 
| endpoint | Optional character of length 1.  | 
| region | Character of length 1.  | 
Value
An R6 job definition object.
IAM policies
In order for the AWS Batch crew job definition class to function
properly, your IAM policy needs permission to perform the
RegisterJobDefinition, DeregisterJobDefinition, and
DescribeJobDefinitions AWS Batch API calls.
For more information on AWS policies and permissions, please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
See Also
Other definition: 
crew_class_definition_aws_batch
Create an AWS Batch launcher object.
Description
Create an R6 AWS Batch launcher object.
Usage
crew_launcher_aws_batch(
  name = NULL,
  workers = 1L,
  seconds_interval = 0.5,
  seconds_timeout = 60,
  seconds_launch = 1800,
  seconds_idle = 300,
  seconds_wall = Inf,
  tasks_max = Inf,
  tasks_timers = 0L,
  reset_globals = NULL,
  reset_packages = NULL,
  reset_options = NULL,
  garbage_collection = NULL,
  crashes_error = NULL,
  tls = crew::crew_tls(mode = "automatic"),
  processes = NULL,
  r_arguments = c("--no-save", "--no-restore"),
  options_metrics = crew::crew_options_metrics(),
  options_aws_batch = crew.aws.batch::crew_options_aws_batch(),
  aws_batch_config = NULL,
  aws_batch_credentials = NULL,
  aws_batch_endpoint = NULL,
  aws_batch_region = NULL,
  aws_batch_job_definition = NULL,
  aws_batch_job_queue = NULL,
  aws_batch_share_identifier = NULL,
  aws_batch_scheduling_priority_override = NULL,
  aws_batch_parameters = NULL,
  aws_batch_container_overrides = NULL,
  aws_batch_node_overrides = NULL,
  aws_batch_retry_strategy = NULL,
  aws_batch_propagate_tags = NULL,
  aws_batch_timeout = NULL,
  aws_batch_tags = NULL,
  aws_batch_eks_properties_override = NULL
)
Arguments
| name | Character string, name of the launcher. If the name is
 | 
| workers | Maximum number of workers to run concurrently
when auto-scaling, excluding task retries and manual calls to  | 
| seconds_interval | Number of seconds between
polling intervals waiting for certain internal
synchronous operations to complete. In certain cases, exponential
backoff is used with this argument passed to  | 
| seconds_timeout | Number of seconds until timing
out while waiting for certain synchronous operations to complete,
such as checking  | 
| seconds_launch | Seconds of startup time to allow.
A worker is unconditionally assumed to be alive
from the moment of its launch until  | 
| seconds_idle | Maximum number of seconds that a worker can idle
since the completion of the last task. If exceeded, the worker exits.
But the timer does not launch until  | 
| seconds_wall | Soft wall time in seconds.
The timer does not launch until  | 
| tasks_max | Maximum number of tasks that a worker will do before exiting. Also determines how often the controller auto-scales. See the Auto-scaling section for details. | 
| tasks_timers | Number of tasks to do before activating
the timers for  | 
| reset_globals | Deprecated on 2025-05-30 ( | 
| reset_packages | Deprecated on 2025-05-30 ( | 
| reset_options | Deprecated on 2025-05-30 ( | 
| garbage_collection | Deprecated on 2025-05-30
( | 
| crashes_error | Deprecated on 2025-01-13 ( | 
| tls | A TLS configuration object from  | 
| processes | Deprecated on 2025-08-27 ( | 
| r_arguments | Optional character vector of command line arguments
to pass to  | 
| options_metrics | Either  | 
| options_aws_batch | List of options from  | 
| aws_batch_config | Deprecated.
Use  | 
| aws_batch_credentials | Deprecated.
Use  | 
| aws_batch_endpoint | Deprecated.
Use  | 
| aws_batch_region | Deprecated.
Use  | 
| aws_batch_job_definition | Deprecated.
Use  | 
| aws_batch_job_queue | Deprecated.
Use  | 
| aws_batch_share_identifier | Deprecated.
Use  | 
| aws_batch_scheduling_priority_override | Deprecated.
Use  | 
| aws_batch_parameters | Deprecated.
Use  | 
| aws_batch_container_overrides | Deprecated.
Use  | 
| aws_batch_node_overrides | Deprecated.
Use  | 
| aws_batch_retry_strategy | Deprecated.
Use  | 
| aws_batch_propagate_tags | Deprecated.
Use  | 
| aws_batch_timeout | Deprecated.
Use  | 
| aws_batch_tags | Deprecated.
Use  | 
| aws_batch_eks_properties_override | Deprecated.
Use  | 
Value
An R6 AWS Batch launcher object.
IAM policies
In order for the AWS Batch crew plugin to function properly, your IAM
policy needs permission to perform the SubmitJob and TerminateJob
AWS Batch API calls. For more information on AWS policies and permissions,
please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
AWS arguments
The AWS Batch controller and launcher accept many arguments
which start with "aws_batch_". These arguments are AWS-Batch-specific
parameters forwarded directly to the submit_job() method for
the Batch client in the paws.compute R package
For a full description of each argument, including its meaning and format, please visit https://www.paws-r-sdk.com/docs/batch_submit_job/. The upstream API documentation is at https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html and the analogous CLI documentation is at https://docs.aws.amazon.com/cli/latest/reference/batch/submit-job.html.
The actual argument names may vary slightly, depending
on which : for example, the aws_batch_job_definition argument of
the crew AWS Batch launcher/controller corresponds to the
jobDefinition argument of the web API and
paws.compute::batch()$submit_job(), and both correspond to the
--job-definition argument of the CLI.
Verbosity
Control verbosity with the paws.log_level global option in R.
Set to 0 for minimum verbosity and 3 for maximum verbosity.
See Also
Other plugin_aws_batch: 
crew_class_launcher_aws_batch,
crew_controller_aws_batch()
Submit an AWS Batch job.
Description
Not a user-side function. For internal use only.
Usage
crew_launcher_aws_batch_launch(args_client, args_submit)
Arguments
| args_client | Named list of arguments to  | 
| args_submit | Named list of arguments to
 | 
Details
This utility is its own separate exported function specific to
the launcher and not shared with the job definition or monitor classes.
It generates the paws.compute::batch() client within itself
instead of a method inside the class.
This is all because it needs to run on a separate local worker process
and it needs to accept exportable arguments.
Value
HTTP response from submitting the job.
Create an AWS Batch monitor object.
Description
Create an R6 object to list, inspect, and terminate
AWS Batch jobs.
Usage
crew_monitor_aws_batch(
  job_queue,
  job_definition,
  log_group = "/aws/batch/job",
  config = NULL,
  credentials = NULL,
  endpoint = NULL,
  region = NULL
)
Arguments
| job_queue | Character vector of names of AWS Batch job queues.
As of  | 
| job_definition | Character string, name of the AWS Batch job definition. | 
| log_group | Character of length 1,
AWS Batch CloudWatch log group to get job logs.
The default log group is often  | 
| config | Optional named list,  | 
| credentials | Optional named list.  | 
| endpoint | Optional character of length 1.  | 
| region | Character of length 1.  | 
IAM policies
In order for the AWS Batch crew monitor class to function
properly, your IAM policy needs permission to perform the SubmitJob,
TerminateJob, ListJobs, and DescribeJobs AWS Batch API calls.
In addition, to download CloudWatch logs with the log() method,
your IAM policy also needs permission to perform the GetLogEvents
CloudWatch logs API call.
For more information on AWS policies and permissions, please visit
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
See Also
Other monitor: 
crew_class_monitor_aws_batch
AWS Batch options
Description
Options for the AWS Batch controller.
Usage
crew_options_aws_batch(
  job_definition = "example",
  job_queue = "example",
  cpus = NULL,
  gpus = NULL,
  memory = NULL,
  memory_units = "gigabytes",
  config = list(),
  credentials = list(),
  endpoint = NULL,
  region = NULL,
  share_identifier = NULL,
  scheduling_priority_override = NULL,
  parameters = NULL,
  container_overrides = NULL,
  node_overrides = NULL,
  retry_strategy = NULL,
  propagate_tags = NULL,
  timeout = NULL,
  tags = NULL,
  eks_properties_override = NULL,
  verbose = FALSE
)
Arguments
| job_definition | Character of length 1, name of the AWS Batch job definition to use. There is no default for this argument, and a job definition must be created prior to running the controller. Please see https://docs.aws.amazon.com/batch/ for details. To create a job definition, you will need to create a Docker-compatible
image which can run R and  | 
| job_queue | Character of length 1, name of the AWS Batch job queue to use. There is no default for this argument, and a job queue must be created prior to running the controller. Please see https://docs.aws.amazon.com/batch/ for details. | 
| cpus | Positive numeric scalar,
number of virtual CPUs to request per job. Can be  | 
| gpus | Positive numeric scalar,
number of GPUs to request per job. Can be  | 
| memory | Positive numeric scalar,
amount of random access memory (RAM) to request per job.
Choose the units of memory with the  | 
| memory_units | Character string, units of memory of the  | 
| config | Named list,  | 
| credentials | Named list.  | 
| endpoint | Character of length 1.  | 
| region | Character of length 1.  | 
| share_identifier | 
 | 
| scheduling_priority_override | 
 | 
| parameters | 
 | 
| container_overrides | 
 | 
| node_overrides | 
 | 
| retry_strategy | 
 | 
| propagate_tags | 
 | 
| timeout | 
 | 
| tags | 
 | 
| eks_properties_override | 
 | 
| verbose | 
 | 
Value
A classed list of options for the controller.
Retryable options
Retryable options are deprecated in crew.aws.batch
as of 2025-01-27 (version 0.0.8).