-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Description
- Right now, relatively simple, calls each function one by one, and for each
function, runs on each host one by one, and the host list may be different
per-function. - What may make more sense is to specify host list "first", then for each
host, you call each function in turn (in which case the order of functions
may matter more than it does now). This would mean that the logic for host
discovery changes a decent amount. - Do we want to allow this to be switched up dynamically? I.e. allow user
to specify a "mode" (like in the old Fabric) to determine which of those
two algorithms is used? - How do these decisions affect what decorators/etc can be applied? I.e.
@hosts doesn't make any sense in the latter scenario because there is only
one global host list per session. (But isn't that the more sensible
solution? Is it ever useful to execute afabcommand line and have the host
list to change during the session?) - See mikeias' fork for one potential
approach: preserves dynamic checking of host/role lists as attached to
tasks via decorators, but thus requires one to call a function with the
task name as a string, instead of simply calling the function itself. May
be worth the tradeoff, and is definitely food for thought. - Also work in the concept of dependencies. Right now users have to explicitly call the other functions, which results in minor DRY violations in some cases at least.
- Argument against dependencies would be that it could introduce magic, i.e. calling a function that is hooked into by other functions is no longer a straight "just calls this one function only".
- Could also be a lot more complex to set up, depending on how the stuff above is approached (i.e. if the above is done without sacrificing a lot of simplicity, this almost definitely would)
As a possible stopgap (or maaaybe long term) simply refactor existing connection/execution stuff so it can be exposed to users, i.e. something encapsulating "call function X on Y host list". Which is essentially the same as mikeias' fork (2nd to last bullet point above) --but with the caveat that this method would not be the only or preferred way to call functions, instead just an additional tool for when the default exec model doesn't fit your needs.
Originally submitted by Jeff Forcier (bitprophet) on 2009-07-21 at 03:02pm EDT
Relations
- Related to Use decorator to define tasks #76: Use decorator to define tasks
- Related to Update get(), env.all_hosts to work for library users #218: Update get(), env.all_hosts to work for library users
- Related to Consider not using set() when merging hosts/roles #243: Consider not using set() when merging hosts/roles
- Related to Externally loaded roledefs #266: Externally loaded roledefs
- Duplicated by Use __call__ instead of __init__ for classes that define one #286: Use call instead of init for classes that define one
- Related to Object-oriented hosts/roles/collections #297: Object-oriented hosts/roles/collections
- Related to Allow tasks to generate new tasks (for other hosts) in the same session #391: Allow tasks to generate new tasks (for other hosts) in the same session
- Related to Implement parallelism/thread-safety #19: Implement parallelism/thread-safety
- Related to Rework output mechanisms #20: Rework output mechanisms