On Monday, December 06, 2010 05:13:20 pm you wrote: > > Based on the experience of writing this code I would like to make > > a > > > > feature suggestion. It would be useful if the "run" method in the > > "Overlord" class could take an optional "mask" argument which could > > instruct it to skip certain Minions. The mask could be a dictionary > > with minion names as the keys and something like True/False as the data. > > Coincidentally this is almost exactly the same structure which is > > returned by the "run" method in the "Overlord" class itself. This > > feature would make it easy and efficient to write functions which have > > multiple "run" calls which are dependent upon one another. > > So - you'd setup an overlord client with a host-specification and then > you want to modify that specification on the fly for the run() method? > > would it be easier/make more sense to just be able to modify the host > specification while the class exists? > > ie: > > fc = Client('myhost;list;of;doom') > fc.change_hosts('newspecification') > fc.run() > > would that do what do what you want? > -sv That would get the job done, but I'm not crazy about destructively modifying the minion list. A command which utilizes multiple "run" calls might run on one subset of the minions at one point and on a different subset at a later point. Trivial example: a command which creates a custom logfile which ends with a line like "Completed at <timestamp>" even on those minions on which nothing was actually done (so that you know it did run on that minion even if it didn't do anything else). To implement this sort of functionality I would have to save the initial minion list and restore it later by calling change_hosts again. To me that seems awkward compared to passing an optional argument to "run", though workable. The third option is to pass the equivalent of a mask to the minions and let them figure out if they're supposed to do anything. This is what my patch does, but the patch also illustrates the problem with this approach. If a function like "append" is run many times (e.g. when a large file is copied) then even minions which are not overwriting the target file have to keep doing things. Specifically they have to keep calling get_hostname_by_route so that they can parse the mask, and this involves querying the overlord to get the hostname for every chunk! -- Marcus _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list