-
Inspired by this issue in airflow for simulating airflow queues in the DaskExecutor using Worker Resources: Is there a way to define an "infinite" worker resource? I think the answer is no, based on what I see regarding |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
What would it mean to to specify a worker as |
Beta Was this translation helpful? Give feedback.
-
Setting it to 1e99 might be effectively the same, and is already
implemented today
…On Fri, Jul 2, 2021 at 9:58 AM aa1371 ***@***.***> wrote:
Was thinking for things that aren't quantifiably limited. E.g. the
existence of an env var, or simply to use the resource as a tag to control
the subset of your cluster that a task can be submitted to, in a manner
analogous to celery queues (not calling this feature a queue, but just mean
that it can mimic this functionality).
In any case I'm realizing now that for cases like this the resource can
likely just be set to a limit of 1 on the worker, it seems like if you have
the following set up:
# 1 dask worker
$ dask-worker <address> --resources="TAG1=1"
# submit 2 tasks requesting the same resource
def task():
time.sleep(10)
client.submit(task, pure=False, resources={'TAG1': 1})
client.submit(task, pure=False, resources={'TAG1': 1})
The scheduler is able to assign both tasks to the worker without issue. I
assumed that if the requested resource on a worker was "depleted" from the
workers POV, that the scheduler wouldn't schedule another task, requesting
that resource, on that worker. But after some quick testing seems that
isn't the case
So my new understanding is that the resource limit is a per instance
threshold, not a cumulative threshold, and for the use cases I mentioned in
the first paragraph (resources as tags) it is sufficient to define a worker
resource limit of 1 as long as you always submit the task with resources={resource:
1}. Is that about right?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5010 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACKZTC5CQCRX4G5QAG7QGTTVXV3XANCNFSM47T2JZNA>
.
|
Beta Was this translation helpful? Give feedback.
-
Works as expected since float('inf') is a valid float, and respects all the behavior I'd expect in the worker resources code, e.g. inf - 1 == inf, inf > 0, etc. |
Beta Was this translation helpful? Give feedback.
Works as expected since float('inf') is a valid float, and respects all the behavior I'd expect in the worker resources code, e.g. inf - 1 == inf, inf > 0, etc.