Skip to content

Commit

Permalink
Synchronize Run
Browse files Browse the repository at this point in the history
  • Loading branch information
Pim Schellart authored and Pim Schellart committed Jan 18, 2018
1 parent e0514e6 commit 763b331
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions python/lsst/butler/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ def makeRun(self, collection):
run: `Run`
A new `Run` instance.
"""
run = Run(runId=Run.getNewId(), registryId=self.id, collection=collection, environmentId=None, pipelineId=None)
run = Run(runId=Run.getNewId(), registryId=self.id, collection=collection, environment=None, pipeline=None)

with self.engine.begin() as connection:
insert = RunTable.insert().values(
run_id=run.runId,
registry_id=run.registryId,
collection=run.collection,
environment_id=run.environmentId,
pipeline_id=run.pipelineId
environment_id=run.environment,
pipeline_id=run.pipeline
)
connection.execute(insert)

Expand All @@ -293,7 +293,7 @@ def updateRun(self, run):
with self.engine.begin() as connection:
# TODO: should it also update the collection?
connection.execute(RunTable.update().where(and_(RunTable.c.run_id == run.runId, RunTable.c.registry_id == run.registryId)).values(
environment_id = run.environmentId, pipeline_id = run.pipelineId))
environment_id = run.environment, pipeline_id = run.pipeline))

def getRun(self, collection=None, id=None):
"""
Expand All @@ -320,10 +320,10 @@ def getRun(self, collection=None, id=None):
runId = result[RunTable.c.run_id]
registryId = result[RunTable.c.registry_id]
collection = result[RunTable.c.collection]
environmentId = result[RunTable.c.environment_id]
pipelineId = result[RunTable.c.pipeline_id]
environment = result[RunTable.c.environment_id]
pipeline = result[RunTable.c.pipeline_id]

return Run(runId, self.id, collection, environmentId, pipelineId)
return Run(runId, self.id, collection, environment, pipeline)
else:
return None

Expand Down
16 changes: 8 additions & 8 deletions python/lsst/butler/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ def getNewId(cls):
cls._currentId += 1
return cls._currentId

__slots__ = ("_runId", "_registryId", "_collection", "_environmentId", "_pipelineId")
__slots__ = ("_runId", "_registryId", "_collection", "_environment", "_pipeline")
__eq__ = slotValuesAreEqual
__hash__ = slotValuesToHash

def __init__(self, runId, registryId, collection, environmentId, pipelineId):
def __init__(self, runId, registryId, collection, environment, pipeline):
self._runId = runId
self._registryId = registryId
self._collection = collection
self._environmentId = environmentId
self._pipelineId = pipelineId
self._environment = environment
self._pipeline = pipeline

@property
def pkey(self):
Expand All @@ -60,9 +60,9 @@ def collection(self):
return self._collection

@property
def environmentId(self):
return self._environmentId
def environment(self):
return self._environment

@property
def pipelineId(self):
return self._pipelineId
def pipeline(self):
return self._pipeline

0 comments on commit 763b331

Please sign in to comment.