-
Notifications
You must be signed in to change notification settings - Fork 1
/
crew_controller_aws_batch.R
110 lines (110 loc) · 3.58 KB
/
crew_controller_aws_batch.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#' @title Create a controller with an AWS Batch launcher.
#' @export
#' @family plugin_aws_batch
#' @description Create an `R6` object to submit tasks and
#' launch workers on AWS Batch workers.
#' @inheritSection crew_launcher_aws_batch IAM policies
#' @inheritSection crew_launcher_aws_batch AWS arguments
#' @inheritSection crew_launcher_aws_batch Verbosity
#' @inheritParams crew::crew_client
#' @inheritParams crew_launcher_aws_batch
#' @inheritParams crew::crew_controller
#' @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()
#' }
crew_controller_aws_batch <- function(
name = NULL,
workers = 1L,
host = NULL,
port = NULL,
tls = crew::crew_tls(mode = "automatic"),
tls_enable = NULL,
tls_config = NULL,
seconds_interval = 0.5,
seconds_timeout = 60,
seconds_launch = 1800,
seconds_idle = Inf,
seconds_wall = Inf,
tasks_max = Inf,
tasks_timers = 0L,
reset_globals = TRUE,
reset_packages = FALSE,
reset_options = FALSE,
garbage_collection = FALSE,
launch_max = 5L,
processes = NULL,
aws_batch_config = list(),
aws_batch_credentials = list(),
aws_batch_endpoint = NULL,
aws_batch_region = NULL,
aws_batch_job_definition,
aws_batch_job_queue,
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
) {
client <- crew::crew_client(
name = name,
workers = workers,
host = host,
port = port,
tls = tls,
tls_enable = tls_enable,
tls_config = tls_config,
seconds_interval = seconds_interval,
seconds_timeout = seconds_timeout
)
launcher <- crew_launcher_aws_batch(
name = name,
seconds_interval = seconds_interval,
seconds_timeout = seconds_timeout,
seconds_launch = seconds_launch,
seconds_idle = seconds_idle,
seconds_wall = seconds_wall,
tasks_max = tasks_max,
tasks_timers = tasks_timers,
reset_globals = reset_globals,
reset_packages = reset_packages,
reset_options = reset_options,
garbage_collection = garbage_collection,
launch_max = launch_max,
tls = tls,
processes = processes,
aws_batch_config = aws_batch_config,
aws_batch_credentials = aws_batch_credentials,
aws_batch_endpoint = aws_batch_endpoint,
aws_batch_region = aws_batch_region,
aws_batch_job_definition = aws_batch_job_definition,
aws_batch_job_queue = aws_batch_job_queue,
aws_batch_share_identifier = aws_batch_share_identifier,
aws_batch_scheduling_priority_override =
aws_batch_scheduling_priority_override,
aws_batch_parameters = aws_batch_parameters,
aws_batch_container_overrides = aws_batch_container_overrides,
aws_batch_node_overrides = aws_batch_node_overrides,
aws_batch_retry_strategy = aws_batch_retry_strategy,
aws_batch_propagate_tags = aws_batch_propagate_tags,
aws_batch_timeout = aws_batch_timeout,
aws_batch_tags = aws_batch_tags,
aws_batch_eks_properties_override = aws_batch_eks_properties_override
)
controller <- crew::crew_controller(client = client, launcher = launcher)
controller$validate()
controller
}