Skip to content

Commit

Permalink
fix: stop worker start when config is too large#
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Feb 10, 2024
1 parent a483f52 commit 1239e3c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion R/Rush.R
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,8 @@ Rush = R6::R6Class("Rush",
dots = list(...)
r = self$connector

lg$debug("Pushing worker config to Redis")

# find globals
if (!is.null(globals)) {
global_names = if (!is.null(names(globals))) names(globals) else globals
Expand All @@ -1392,7 +1394,15 @@ Rush = R6::R6Class("Rush",
worker_args = worker_args)

# serialize and push arguments to redis
r$command(list("SET", private$.get_key("start_args"), redux::object_to_bin(start_args)))
bin_start_args = redux::object_to_bin(start_args)

if (object.size(bin_start_args) > 5369e5) {
stop("Worker configuration is larger than 512 MiB. Redis does not support values larger than 512 MiB.")
}

lg$debug("Serializing worker configuration to %s", format(object.size(bin_start_args)))

r$command(list("SET", private$.get_key("start_args"), bin_start_args))
},

# fetch tasks
Expand Down

0 comments on commit 1239e3c

Please sign in to comment.