New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make it possible to start engine in 'disabled' mode and 'enable' later #1454
Comments
If you know what code you need to run when you are bringing up an engine, you can add it as startup script or command, either as:
Which correspond to the This code is run before the engine is made available to the Scheduler. Can you describe your case in more detail if this doesn't suffice? |
I would like to get some information about each engine on startup and store it in MongoDB for later use (engine_id, hostname, arch, os, proctype, nbits, procspeed, ncpus, ncpucores, memory, load, address, pools). Depending on these information, I can give tasks to specific engines. I will try out your hint. But I guess that the engine isn't registered at the time excuting startup_script / startup_command, which would mean that the engine_id is unknown. |
Is it possible to get the engine_id inside of the called startup_script? |
Hm, It's technically possible, though I'm not certain these are fully public APIs that I would trust to remain stable: from IPython.config.application import Application
# grab the global application instance
app = Application.instance()
# and its integer engine ID
engine_id = app.engine.id |
Thanks a lot, this works! Now I can get all needed information about a connected engine at startup and store that info in MongoDB. Later, I can lookup that information with the engine_id of each engine stored in client.ids, without having to wait until the current task is finished. Sadly IPython doesn't seem to support a out-of-band DirectView on engines while LoadBalanced tasks are running. |
Yes and no. Obviously, only one task can run at a time (it is Python, after all), but task and mux queues are fair-queued, so if you submit a direct task, it will run before any queued LoadBalanced tasks, as soon as the current task finishes. |
Also, I realize that you can possibly get your own 'disabled' mode in the startup script by running a command that blocks until a certain condition is met. I'm not sure if this would actually work in practice, but it's an idea. |
The problem I have is, that my tasks fail because of UnmetDependency. The dependency can only be met after I ran some code on the engines, which obviously needs to run before a task is given an engine. If a task is given before my code was run, the task will always fail.
A workaround could be to have a 'disabled' mode (for parallel tasks) for an engine at startup. Then it would be possible to run special code on an engine via direct view, 'enable' the engine and finally receive parallel tasks.
The text was updated successfully, but these errors were encountered: