Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Add support for forcing some long running methods to be called in asy…
Browse files Browse the repository at this point in the history
…nc mode from command line.
  • Loading branch information
Krzysztof A. Adamski committed Jun 29, 2008
1 parent d774652 commit a5929a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions etc/async_methods.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[main]
force_async = command.run, yumcmd.update, virt.install
1 change: 1 addition & 0 deletions func.spec
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ rm -fr $RPM_BUILD_ROOT
%dir %{_sysconfdir}/%{name}/minion-acl.d/
%dir /etc/func/modules/
%config(noreplace) /etc/func/minion.conf
%config(noreplace) /etc/func/async_methods.conf
%config(noreplace) /etc/logrotate.d/func_rotate
%dir %{python_sitelib}/func
%dir %{python_sitelib}/func/minion
Expand Down
9 changes: 9 additions & 0 deletions func/overlord/cmd_modules/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@
import pprint
import xmlrpclib
import time
import sys

from func.overlord import client
from func.overlord import base_command
from func.config import read_config, BaseConfig, ListOption

import func.jobthing as jobthing

DEFAULT_FORKS = 1
config_file = '/etc/func/async_methods.conf'

class CallConfig(BaseConfig):
force_async = ListOption('')

class Call(base_command.BaseCommand):
name = "call"
Expand Down Expand Up @@ -126,6 +132,9 @@ def do(self, args):
# or some sort of shared datastruct?
# self.getOverlord()

call_config = read_config(config_file, CallConfig)
if self.method and (self.module+"."+self.method in call_config.force_async):
self.options.async=True

self.interactive = False
self.async = self.options.async
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
],
data_files = [(initpath, ["init-scripts/funcd"]),
(etcpath, ["etc/minion.conf"]),
(etcpath, ["etc/async_methods.conf"]),
(manpath, ["docs/func.1.gz"]),
(manpath, ["docs/func-inventory.1.gz"]),
(manpath, ["docs/funcd.1.gz"]),
Expand Down

0 comments on commit a5929a0

Please sign in to comment.