Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/demo/producer_consumer.py b/demo/producer_consumer.py
index 8d4a236..e80bf39 100644
--- a/demo/producer_consumer.py
+++ b/demo/producer_consumer.py
@@ -5,6 +5,7 @@
# of patent rights can be found in the PATENTS file in the same directory.
#
from six.moves import xrange
+from sparts.sparts import option
from sparts.tasks.periodic import PeriodicTask
from sparts.tasks.queue import QueueTask
from sparts.vservice import VService
@@ -23,6 +24,10 @@ class Producer(PeriodicTask):
INTERVAL = 1.0
DEPS = [Consumer]
+ foobar = option(
+ default=[],
+ nargs='*',
+ )
def initTask(self):
super(Producer, self).initTask()
self.consumer = self.service.tasks.Consumer
@@ -32,6 +37,7 @@ class Producer(PeriodicTask):
item = random.random()
self.consumer.queue.put(item)
self.logger.info("Producer put %s into queue", item)
+ self.logger.info("option foobar type: {} value: {}".format(type(self.foobar), self.foobar))
class ProducerConsumer(VService):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.