Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Commit

Permalink
managing objects ids for archive in RAM and ont only in DB
Browse files Browse the repository at this point in the history
  • Loading branch information
teskenazi committed Jun 11, 2015
1 parent faabd91 commit 617aefa
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/octopus/dispatcher/db/pulidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,3 +1449,44 @@ def archivePoolShare(pulidb, element):
PoolShares.q.archived.fieldName: True}
conn.query(conn.sqlrepr(Insert(PoolShares.q, values=fields)))

@staticmethod
def getMaxID(Table):
conn = Table._connection
Table._connection = StatDB.createConnection()
result = Table.select().max(Table.q.id)
Table._connection = conn
if result:
return int(result)
return 0

@staticmethod
def getRenderNodesMaxId():
return StatDB.getMaxID(RenderNodes)

@staticmethod
def getFolderNodesMaxId():
return StatDB.getMaxID(FolderNodes)

@staticmethod
def getTaskNodesMaxId():
return StatDB.getMaxID(TaskNodes)

@staticmethod
def getTasksMaxId():
return StatDB.getMaxID(Tasks)

@staticmethod
def getTaskGroupsMaxId():
return getMaxID(TaskGroups)

@staticmethod
def getPoolsMaxId():
return StatDB.getMaxID(Pools)

@staticmethod
def getPoolSharesMaxId():
return StatDB.getMaxID(PoolShares)

@staticmethod
def getCommandsMaxId():
return StatDB.getMaxID(Commands)

0 comments on commit 617aefa

Please sign in to comment.