alexhsamuel / procstar

Other
1 stars 0 forks source link

Is it feasible to run max of 1 proc at a time per agent? #41

Open gusostow opened 4 days ago

gusostow commented 4 days ago

I'm kicking around the idea of using procstar as the basis for a containerized parallel computing tool. It would bear some similarity to the ProcstarECSProgram, except the agents would live longer than a single job, to support larger quantities of short duration jobs. The service would periodically scale in/out containerized procstar agents based on the number of queued tasks.

A requirement is that agents shouldn't run more than one proc at once. Does the procstar server have the information to chose only idling agents in a group with choose_connection? I'm not totally sure if Connection.shutdown_state records this.

If this isn't possible, I could do the bookkeeping of tracking agent state externally and target existing agents directly by placing 1 per group. Using procstar for state tracking and selection would be a lot nicer though.

gusostow commented 4 days ago

Sorry hit enter before I finished typing. Will edit

EDIT: completed my original issue.

alexhsamuel commented 4 days ago

Yes, the Procstar server tracks processes and connections (and which proc is running on which connection). It's not guaranteed to be perfectly timely and correct, but it should be good enough for this purpose. (Mostly, if the proc just completed, this will be briefly out of date, but that's probably OK.)

conn_ids = { c.conn_id for c in server.connections }
free_conn_ids = conn_ids - { p.conn_id for p in server.processes }

Of course you could partition by group ID, etc.