Skip to content

Commit

Permalink
fix up scheduler header
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-wahl committed Jun 5, 2024
1 parent 6c07d98 commit 5ecfbd2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions backend/workers/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Scheduler(BasicWorker):
work_report = None
details = None

def ensure_database(self):
@staticmethod
def ensure_database(db):
"""
Ensure that the database is set up for this worker
Expand All @@ -35,14 +36,14 @@ def ensure_database(self):
details: additional details for the job (potentially different for each job)
"""
# create the table if it doesn't exist
self.db.execute("CREATE TABLE IF NOT EXISTS scheduled_jobs (job_id int PRIMARY KEY, scheduler_id int NOT NULL, jobtype text NOT NULL, dataset_id text NOT NULL, status text NOT NULL, created_at integer, details jsonb)")
db.execute("CREATE TABLE IF NOT EXISTS scheduled_jobs (job_id int PRIMARY KEY, scheduler_id int NOT NULL, jobtype text NOT NULL, dataset_id text NOT NULL, status text NOT NULL, created_at integer, details jsonb)")

def work(self):
"""
Check previous scheduled jobs and schedule new ones as necessary
"""
# TODO: ensure_database could be called when workers are validated; we could even check for packages there
self.ensure_database()
self.ensure_database(self.db)
# Ensure clean work report
self.work_report = {}

Expand Down Expand Up @@ -112,7 +113,7 @@ def schedule_job(self, first=False):
"processor_type": processor.type,
"extension": processor.get_extension(dataset.get_parent()),
"is_private": dataset.is_private,
"parameters": parameters,
"parameters": dataset.parameters.copy(),
"label": dataset.get_label(),
"last_dataset": dataset.key
})
Expand Down
3 changes: 3 additions & 0 deletions webtool/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ <h1>
{% endif %}
<li{% if navigation.current == "dataset" %} class="current"{% endif %}><a href="{{ url_for('show_results') }}">Datasets</a></li>
<li{% if navigation.current == "datasources" %} class="current"{% endif %}><a href="{{ url_for('data_overview') }}">Data sources</a></li>
{% if __user_config("privileges.can_schedule_datasources") %}
<li{% if navigation.current == "scheduler" %} class="current"{% endif %}><a href="{{ url_for('show_scheduler') }}">Scheduler</a></li>
{% endif %}
{% if current_user.is_authenticated and not current_user.is_special and __user_config("privileges.can_create_api_token") %}
<li{% if navigation.current == "api-access" %} class="current"{% endif %}><a href="{{ url_for('show_access_tokens') }}">API Access</a></li>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion webtool/templates/scheduler.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block title %}Job Scheduler{% endblock %}
{% block body_class %}result-list plain-page{% endblock %}
{% block breadcrumbs %}{% set navigation.current = "dataset" %}{% endblock %}
{% block breadcrumbs %}{% set navigation.current = "scheduler" %}{% endblock %}

{% block body %}
<article>
Expand Down

0 comments on commit 5ecfbd2

Please sign in to comment.