1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +01:00
phorge-phorge/scripts
epriestley f0fdcf1a51 Undumb the Drydock resource allocator pipeline
Summary:
This was the major goal of D3859/D3855, and to a lesser degree D3854/D3852.

As Drydock is allocating a resource, it may need to allocate other resources first. For example, if it's allocating a working copy, it may need to allocate a host first.

Currently, we have the process basically queue up the allocation (insert a task into the queue) and sleep() until it finishes. This is problematic for a bunch of reasons, but the major one is that if allocation takes more resources (host, port, machine, DNS) than you have daemons, they could all end up sleeping and waiting for some other daemon to do their work. This is really stupid. Even if you only take up some of them, you're spending slots sleeping when you could be doing useful work.

To partially get around this and make the CLI experience less dumb, there's this goofy `synchronous` flag that gets passed around everywhere and pushes the workflow through a pile of special cases. Basically the `synchronous` flag causes us to do everything in-process. But this is dumb too because we'd rather do things in parallel if we can, and we have to have a lot of special case code to make it work at all.

Get rid of all of this. Instead of sleep()ing, try to work on the tasks that need to be worked on. If another daemon grabbed them already that's fine, but in the worst case we just gracefully degrade and do everything in process. So we get the best of both worlds: if we have parallelizable tasks and free daemons, things will execute in parallel. If we have nonparallelizable tasks or no free daemons, things will execute in process.

Test Plan: Ran `drydock_control.php --trace` and saw it perform cascading allocations without sleeping or special casing.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D3861
2012-11-01 11:30:42 -07:00
..
aphront Support applications in aphrontpath.php 2012-08-10 10:48:08 -07:00
calendar Display holidays 2012-05-03 09:22:52 -07:00
celerity Add Drydock Application 2012-10-31 09:57:57 -07:00
conduit Depend on class autoloading 2012-05-30 16:57:21 -07:00
daemon Separates the PID and log directories of daemons 2012-08-05 08:35:24 +02:00
differential Use PhutilArgumentParser in reparse.php 2012-08-13 19:35:30 -07:00
drydock Undumb the Drydock resource allocator pipeline 2012-11-01 11:30:42 -07:00
fact Add FactCursors and application fact datasources 2012-07-30 10:43:49 -07:00
files Add a script to migrate files between storage engines 2012-10-25 11:36:38 -07:00
fpm Fix minor issues with D2630 2012-06-06 09:12:42 -07:00
install [Ubuntu Install Script] Automatically enable mod_rewrite 2012-10-05 15:54:23 -07:00
mail Move completed tasks to an "archive" table and delete them in the GC 2012-10-31 15:22:16 -07:00
profile quick, ghetto script to rescale profile pictures 2012-08-13 15:29:34 -07:00
repository Move completed tasks to an "archive" table and delete them in the GC 2012-10-31 15:22:16 -07:00
search Optimize reindex_everything.php 2012-09-17 13:34:41 -07:00
setup Test for pcntl availability from the command line, not Apache 2011-05-30 21:02:08 -07:00
sql Use 'w' connection in bin/storage 2012-09-13 22:36:35 -07:00
symbols Add option to symbol import script to ignore errors in input 2012-09-27 15:36:38 -07:00
user bin/accountadmin - allow creation of system accounts and create workflow for system accounts that are in trouble 2012-08-29 11:07:29 -07:00
util Use the unified markup cache for Maniphest 2012-07-11 11:40:10 -07:00
__init_script__.php Fix a bug found by vrana in audit 2012-10-01 15:15:07 -07:00
celerity_mapper.php Add local navigation to Differential 2012-08-21 15:01:20 -07:00