You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if RAY has the ability to pause and continue tasks distributed to the cluster's nodes.
For example, if there is a task running in my cluster, but at this point, a higher-priority task has to be executed immediately. I wonder if RAY is able to pause the low-priority task and then switch to execute the high-priority one. After it's finished, the low-priority one continues to run.
Any help would be appreciated!!!
The text was updated successfully, but these errors were encountered:
It is not supported by our APIs. You can probably use AsyncActor to implement this in application level, but it could be hard. The code below is a brief idea.
@ray.remoteclassTaskRunner:
def__init__(self):
self.pause=Trueself.resume_context= {}
self.task_id="hash_value"asyncdefrun_task(self, id=None):
assertself.pause==Trueself.pause=Falseifnotid:
awaitself.run({})
else:
self.task_id=idawaitself.run(self.resume_context[id])
asyncdefrun(self, context):
whileTrue:
ifself.pause:
self.resume_context[self.task_id] =contextreturn# do something and store state in resume_contextawaitasyncio.sleep(0)
asyncdefpause_request(self):
self.pause=Truereturnself.task_idt=TaskRunner.remote()
t.run_task.remote()
paused_task_id=t.pause_request.remote()
t.run_task.remote()
t.run_task.remote(id=paused_task_id)
What is your question?
I'm not sure if RAY has the ability to pause and continue tasks distributed to the cluster's nodes.
For example, if there is a task running in my cluster, but at this point, a higher-priority task has to be executed immediately. I wonder if RAY is able to pause the low-priority task and then switch to execute the high-priority one. After it's finished, the low-priority one continues to run.
Any help would be appreciated!!!
The text was updated successfully, but these errors were encountered: