Skip to content

Commit

Permalink
Allow 'service' tasks to have an option value
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Aug 20, 2018
1 parent 2f177bb commit 99d7e5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/pywws/regulartasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,15 @@ def _do_common(self, now, sections, live_data=None):
text_tasks = []
plot_tasks = []
for section in sections:
for name in eval(self.params.get(section, 'services', '[]')):
if name not in service_tasks:
service_tasks.append(name)
for task in self._parse_templates(section, 'services'):
if task not in service_tasks:
service_tasks.append(task)
for task in self._parse_templates(section, 'text'):
if task not in text_tasks:
text_tasks.append(task)
for task in self._parse_templates(section, 'plot'):
if task not in plot_tasks:
plot_tasks.append(task)
# do service tasks
for name in service_tasks:
if name in self.services:
self.services[name].upload(live_data=live_data)
# do plot templates
for template, flags in plot_tasks:
self.do_plot(template, local='L' in flags)
Expand All @@ -175,6 +171,10 @@ def _do_common(self, now, sections, live_data=None):
self.do_twitter(template, live_data)
continue
self.do_template(template, data=live_data, local='L' in flags)
# do service tasks
for name, option in service_tasks:
if name in self.services:
self.services[name].upload(live_data=live_data, option=option)
# upload non local files
upload_files = []
for name in os.listdir(self.uploads_directory):
Expand Down
2 changes: 1 addition & 1 deletion src/pywws/service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, context):
self.upload_thread = UploadThread(self, context)
self.stop = self.upload_thread.stop

def upload(self, catchup=True, live_data=None, test_mode=False):
def upload(self, catchup=True, live_data=None, test_mode=False, option=''):
OK = True
count = 0
for data, live in self.next_data(catchup and not test_mode, live_data):
Expand Down

0 comments on commit 99d7e5a

Please sign in to comment.