From 52b43f3e2f808602848aa9c56dbb8adadcd36a98 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 14 Jul 2014 18:42:03 -0700 Subject: [PATCH] Allow a jobs posted book to be none by default Not all users of jobs and jobboards are using the associated book that accompanies a job, instead they are fine with just using the name and the details that can be provided for usage in their application. Example: http://review.openstack.org/#/c/91763/ To allow the optional usage of books with jobs (which is already supported) by default set the book to none and allow it to be provided on a as needed basis. Change-Id: I69e370a733e44c45c62177008838c259fd9c9a7c --- taskflow/jobs/backends/impl_zookeeper.py | 2 +- taskflow/jobs/jobboard.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/taskflow/jobs/backends/impl_zookeeper.py b/taskflow/jobs/backends/impl_zookeeper.py index be305a12..0eacea46 100644 --- a/taskflow/jobs/backends/impl_zookeeper.py +++ b/taskflow/jobs/backends/impl_zookeeper.py @@ -432,7 +432,7 @@ class ZookeeperJobBoard(jobboard.NotifyingJobBoard): else: child_proc(request) - def post(self, name, book, details=None): + def post(self, name, book=None, details=None): def format_posting(job_uuid): posting = { diff --git a/taskflow/jobs/jobboard.py b/taskflow/jobs/jobboard.py index c93123a5..d7d0850f 100644 --- a/taskflow/jobs/jobboard.py +++ b/taskflow/jobs/jobboard.py @@ -118,14 +118,14 @@ class JobBoard(object): """ @abc.abstractmethod - def post(self, name, book, details=None): + def post(self, name, book=None, details=None): """Atomically creates and posts a job to the jobboard. This posting allowing others to attempt to claim that job (and - subsequently work on that job). The contents of the provided logbook - must provide *enough* information for others to reference to - construct & work on the desired entries that are contained in that - logbook. + subsequently work on that job). The contents of the provided logbook, + details dictionary, or name (or a mix of these) must provide *enough* + information for consumers to reference to construct and perform that + jobs contained work (whatever it may be). Once a job has been posted it can only be removed by consuming that job (after that job is claimed). Any entity can post/propose jobs