summaryrefslogtreecommitdiffstats
path: root/func/minion/modules/jobs.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-01-23 15:58:48 -0500
committerMichael DeHaan <mdehaan@redhat.com>2008-01-23 15:58:48 -0500
commit19e4d1ba808cbbe95568271a5b0075b8422e4fb6 (patch)
tree197d55cf717319c5ffe565f9aa8a639b962fc490 /func/minion/modules/jobs.py
parentce0eaca23fb42f77f67408e509bbe091f4c27e56 (diff)
downloadthird_party-func-19e4d1ba808cbbe95568271a5b0075b8422e4fb6.tar.gz
third_party-func-19e4d1ba808cbbe95568271a5b0075b8422e4fb6.tar.xz
third_party-func-19e4d1ba808cbbe95568271a5b0075b8422e4fb6.zip
Double-barrel asynchronous calls. Async can now occur on both sides simultaneously and still appears as if there is only one
"global" job id to the API caller, the minion job id's are managed in the background, complete with partial result response as things come in which should be very nice for ajaxy implication. job_status API does still need to be modified to list active jobs as well as to store the job name.
Diffstat (limited to 'func/minion/modules/jobs.py')
-rw-r--r--func/minion/modules/jobs.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/func/minion/modules/jobs.py b/func/minion/modules/jobs.py
new file mode 100644
index 0000000..69fb75f
--- /dev/null
+++ b/func/minion/modules/jobs.py
@@ -0,0 +1,36 @@
+## (Largely internal) module for access to asynchoronously dispatched
+## module job ID's. The Func Client() module wraps most of this usage
+## so it's not entirely relevant to folks using the CLI or Func API
+## directly.
+##
+## Copyright 2008, Red Hat, Inc
+## Michael DeHaan <mdehaan@redhat.com>
+##
+## This software may be freely redistributed under the terms of the GNU
+## general public license.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##
+
+import codes
+from func import jobthing
+import func_module
+
+# =================================
+
+class JobsModule(func_module.FuncModule):
+
+ version = "0.0.1"
+ api_version = "0.0.1"
+ description = "Internal module for tracking background minion tasks."
+
+ def job_status(self, job_id):
+ """
+ Returns job status in the form of (status, datastruct).
+ Datastruct is undefined for unfinished jobs. See jobthing.py and
+ Wiki details on async invocation for more information.
+ """
+ return jobthing.job_status(job_id)
+