mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Wrap session.flush in populate_uuid script
This commit is contained in:
@@ -15,6 +15,7 @@ import uuid
|
||||
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "lib")))
|
||||
|
||||
import galaxy.config
|
||||
from galaxy.model.base import transaction
|
||||
from galaxy.model.mapping import init_models_from_config
|
||||
from galaxy.util.script import (
|
||||
app_properties_from_args,
|
||||
@@ -37,18 +38,21 @@ def main():
|
||||
app_properties = app_properties_from_args(args)
|
||||
config = galaxy.config.Configuration(**app_properties)
|
||||
model = init_models_from_config(config)
|
||||
session = model.context()
|
||||
|
||||
for row in model.context.query(model.Dataset):
|
||||
if row.uuid is None:
|
||||
row.uuid = uuid.uuid4()
|
||||
print("Setting dataset:", row.id, " UUID to ", row.uuid)
|
||||
model.context.flush()
|
||||
with transaction(session):
|
||||
session.commit()
|
||||
|
||||
for row in model.context.query(model.Workflow):
|
||||
if row.uuid is None:
|
||||
row.uuid = uuid.uuid4()
|
||||
print("Setting Workflow:", row.id, " UUID to ", row.uuid)
|
||||
model.context.flush()
|
||||
with transaction(session):
|
||||
session.commit()
|
||||
print("Complete")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user