Created
March 30, 2016 17:11
-
-
Save chantra/66abd186d893f7791ec342f5f77bafc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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