From 2e89615ab99d6a95bccc22785293118917d9b3f6 Mon Sep 17 00:00:00 2001 From: "Timothy M. Shead" Date: Tue, 20 Aug 2013 11:28:26 -0600 Subject: [PATCH] Models store a reference to the worker that created them, so we can keep track of progress. See #33. --- packages/slycat/web/server/handlers.py | 1 + packages/slycat/web/server/worker/model/__init__.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/packages/slycat/web/server/handlers.py b/packages/slycat/web/server/handlers.py index bd9b11d41..4a4de37e7 100644 --- a/packages/slycat/web/server/handlers.py +++ b/packages/slycat/web/server/handlers.py @@ -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"]) diff --git a/packages/slycat/web/server/worker/model/__init__.py b/packages/slycat/web/server/worker/model/__init__.py index 26057fa51..912b97bec 100644 --- a/packages/slycat/web/server/worker/model/__init__.py +++ b/packages/slycat/web/server/worker/model/__init__.py @@ -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.")