Skip to content

Commit

Permalink
Merge branch 'main' into 1882-add-validation-of-task-collection-payload
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Oct 10, 2024
2 parents 7470379 + e937ff8 commit 9433473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
12 changes: 3 additions & 9 deletions fractal_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@
"update-db-data",
description="Apply data-migration script to an existing database.",
)
update_db_data_parser.add_argument(
"--dry-run",
action="store_true",
help="If set, perform a dry run of the data migration.",
default=False,
)


def save_openapi(dest="openapi.json"):
Expand Down Expand Up @@ -126,7 +120,7 @@ def set_db(skip_init_data: bool = False):
print()


def update_db_data(dry_run: bool = False):
def update_db_data():
"""
Apply data migrations.
"""
Expand Down Expand Up @@ -191,7 +185,7 @@ def _slugify_version(raw_version: str) -> str:
sys.exit()

print("OK, now starting data-migration script\n")
current_update_db_data_module.fix_db(dry_run=dry_run)
current_update_db_data_module.fix_db()


def run():
Expand All @@ -202,7 +196,7 @@ def run():
elif args.cmd == "set-db":
set_db(skip_init_data=args.skip_init_data)
elif args.cmd == "update-db-data":
update_db_data(dry_run=args.dry_run)
update_db_data()
elif args.cmd == "start":
uvicorn.run(
"fractal_server.main:app",
Expand Down
12 changes: 1 addition & 11 deletions fractal_server/data_migrations/2_7_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def prepare_task_groups(
user_mapping: dict[str, int],
default_user_group_id: int,
default_user_id: int,
dry_run: bool,
db: Session,
):
stm_tasks = select(TaskV2).order_by(TaskV2.id)
Expand Down Expand Up @@ -236,14 +235,6 @@ def prepare_task_groups(

print()

if dry_run:
print(
"End dry-run of handling task group with key "
f"'{task_group_key}"
)
print("-" * 80)
continue

task_group = TaskGroupV2(**task_group_attributes)
db.add(task_group)
db.commit()
Expand All @@ -254,7 +245,7 @@ def prepare_task_groups(
return


def fix_db(dry_run: bool = False):
def fix_db():
logger.warning("START execution of fix_db function")
_check_current_version("2.7.0")

Expand All @@ -268,7 +259,6 @@ def fix_db(dry_run: bool = False):
default_user_id=default_user_id,
default_user_group_id=default_user_group_id,
db=db,
dry_run=dry_run,
)

logger.warning("END of execution of fix_db function")

0 comments on commit 9433473

Please sign in to comment.