mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Upgrade syntax using `pyupgrade --py36-plus` . Manually drop several `six` imports. Also: - Remove broken pr_cache in scripts/bootstrap_history.py - Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
53 lines
1.5 KiB
Python
Executable File
53 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
"""
|
|
Populates blank uuid fields in datasets with randomly generated values
|
|
|
|
Going forward, these ids will be generated for all new datasets. This
|
|
script fixes datasets that were generated before the change.
|
|
"""
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
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.util.script import app_properties_from_args, populate_config_args
|
|
|
|
DESCRIPTION = """
|
|
Populates blank uuid fields in datasets with randomly generated values.
|
|
|
|
Going forward, these ids will be generated for all new datasets. This
|
|
script fixes datasets that were generated before the change.
|
|
"""
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(DESCRIPTION)
|
|
populate_config_args(parser)
|
|
args = parser.parse_args()
|
|
|
|
app_properties = app_properties_from_args(args)
|
|
config = galaxy.config.Configuration(**app_properties)
|
|
model = galaxy.config.init_models_from_config(config)
|
|
|
|
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()
|
|
|
|
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()
|
|
print("Complete")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|