diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-11-30 17:45:41 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-11-30 17:45:41 -0500 |
commit | ef6fbe4bcdd5e5493fb46b7b04a4aa84d3d113ec (patch) | |
tree | 94a850c8847bfa6e327786e912c2cebba8b989b3 /func/overlord/cmd_modules | |
parent | 63789f4c32fea66ed11eed9a1c9871b93b284f7b (diff) | |
download | third_party-func-ef6fbe4bcdd5e5493fb46b7b04a4aa84d3d113ec.tar.gz third_party-func-ef6fbe4bcdd5e5493fb46b7b04a4aa84d3d113ec.tar.xz third_party-func-ef6fbe4bcdd5e5493fb46b7b04a4aa84d3d113ec.zip |
Integrating the multiplexer feature (forkbomb.py) with func's Client module. This can be wired up to other modules as well, but I've only added it to "call" for now. To use it, pass in the option --forks=N, ex --forks=3 on the command line as an option to "call". The default is forks==1 which completely bypasses the fork code, just to ensure we don't break anything using the Func API that might not like it. (However I'm pretty sure it would be fine).
Diffstat (limited to 'func/overlord/cmd_modules')
-rw-r--r-- | func/overlord/cmd_modules/call.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/func/overlord/cmd_modules/call.py b/func/overlord/cmd_modules/call.py index b3484f6..b62131f 100644 --- a/func/overlord/cmd_modules/call.py +++ b/func/overlord/cmd_modules/call.py @@ -23,6 +23,7 @@ from func.overlord import command from func.overlord import client DEFAULT_PORT = 51234 +DEFAULT_FORKS = 1 class Call(client.command.Command): name = "call" @@ -41,6 +42,9 @@ class Call(client.command.Command): action="store_true") self.parser.add_option("-p", "--port", dest="port", default=DEFAULT_PORT) + self.parser.add_option("-f", "--forks", dest="forks", + help="how many parallel processes? (default 1)", + default=DEFAULT_FORKS) def handleOptions(self, options): self.options = options @@ -85,9 +89,15 @@ class Call(client.command.Command): # I kind of feel like we shouldn't be parsing args here, but I'm # not sure what the write place is -al; - self.module = args[0] - self.method = args[1] - self.method_args = args[2:] + self.module = args[0] + if len(args) > 1: + self.method = args[1] + else: + self.method = None + if len(args) > 2: + self.method_args = args[2:] + else: + self.method_args = [] # this could get weird, sub sub classes might be calling this # this with multiple.parentCommand.parentCommands... @@ -96,7 +106,7 @@ class Call(client.command.Command): self.server_spec = self.parentCommand.server_spec client_obj = client.Client(self.server_spec,port=self.port,interactive=True, - verbose=self.verbose, config=self.config) + verbose=self.verbose, config=self.config, nforks=self.options.forks) results = client_obj.run(self.module, self.method, self.method_args) # TO DO: add multiplexer support |