Ensure that pipeline version matches files
When the git repository is pulled while a pipeline is running and the wpull plugin is updated in that pull, jobs started afterwards will be using the new code but report the old pipeline version in the UA until the pipeline is stopped and restarted. The plugin somehow needs to check that the pipeline version matches with the files, ideally without duplicating the pipeline version number (so perhaps we should move the version number to a separate file which gets loaded by both pipeline.py and the plugin).
diff --git a/pipeline/archivebot/seesaw/tasks.py b/pipeline/archivebot/seesaw/tasks.py
index b2c5fa9..b72ace7 100644
--- a/pipeline/archivebot/seesaw/tasks.py
+++ b/pipeline/archivebot/seesaw/tasks.py
@@ -101,7 +101,7 @@ class RetryableTask(Task):
 
 class GetItemFromQueue(RetryableTask):
     def __init__(self, control, pipeline_id, pipeline_nick, retry_delay=5,
-        ao_only=False, large=False):
+        ao_only=False, large=False, version_check = None):
         RetryableTask.__init__(self, 'GetItemFromQueue')
         self.control = control
         self.pipeline_id = pipeline_id
@@ -111,8 +111,16 @@ class GetItemFromQueue(RetryableTask):
         self.pipeline_queue = 'pending:%s' % self.pipeline_id
         self.ao_only = ao_only
         self.large = large
+        # (versionOnStartup, versionFunc) where the latter is an argument-less function returning the current version of the files
+        self.version_on_startup, self.version_func = version_check
 
     def process(self, item):
+        # Check that the files haven't changed since the pipeline was launched
+        currentVersion = self.version_func()
+        if currentVersion != self.version_on_startup:
+            item.log_output('Version has changed from {!r} on startup to {!r} now'.format(self.version_on_startup, currentVersion))
+            raise Exception('Version has changed from {!r} on startup to {!r} now'.format(self.version_on_startup, currentVersion))
+
         try: 
             ident, job_data = self.control.reserve_job(self.pipeline_id,
                     self.pipeline_nick, self.ao_only, self.large)
diff --git a/pipeline/pipeline.py b/pipeline/pipeline.py
index 84df1a5..689432a 100644
--- a/pipeline/pipeline.py
+++ b/pipeline/pipeline.py
@@ -141,7 +141,8 @@ pipeline = Pipeline(
     CheckIP(),
     CheckLocalWebserver(),
     GetItemFromQueue(control, pipeline_id, downloader,
-        ao_only=env.get('AO_ONLY'), large=env.get('LARGE')),
+        ao_only=env.get('AO_ONLY'), large=env.get('LARGE'),
+        version_check = (VERSION, pipeline_version)),
     StartHeartbeat(control),
     SetFetchDepth(),
     PreparePaths(),
['pipeline/pipeline.py', 'pipeline/archivebot/seesaw/tasks.py']