Skip to content

Commit

Permalink
Models store a reference to the worker that created them, so we can k…
Browse files Browse the repository at this point in the history
…eep track of progress. See #33.
  • Loading branch information
tshead2 committed Aug 20, 2013
1 parent f9528db commit 2e89615
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/slycat/web/server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def get_model(mid, **kwargs):
context.update(model)
context["is-project-administrator"] = slycat.web.server.authentication.is_project_administrator(project)
context["new-model-name"] = "Model-%s" % (model_count + 1)
context["worker"] = model.get("worker", "null")

marking = cherrypy.request.app.config["slycat"]["marking"]
context["marking-html"] = marking.html(model["marking"])
Expand Down
5 changes: 5 additions & 0 deletions packages/slycat/web/server/worker/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ def work(self):
self.couchdb = slycat.web.server.database.couchdb.connect()
self.scidb = slycat.web.server.database.scidb.connect()

# Store the worker ID in the model ...
with self.model_lock:
self.model["worker"] = self.status["_id"]
slycat.web.server.database.couchdb.connect().save(self.model)

# Optionally, wait for clients to add input artifacts to the model ...
if self.incremental:
self.set_message("Waiting for requests.")
Expand Down

0 comments on commit 2e89615

Please sign in to comment.