File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed
packages/postgres-database/src/simcore_postgres_database/migration/versions
src/simcore_service_director_v2/modules/db/repositories
tests/unit/with_dbs/comp_scheduler Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 66
77"""
88
9+ import sqlalchemy as sa
910from alembic import op
1011
1112# revision identifiers, used by Alembic.
@@ -26,23 +27,27 @@ def downgrade() -> None:
2627
2728 # Find all tables and columns that use statetype enum
2829 result = op .get_bind ().execute (
29- """
30+ sa .DDL (
31+ """
3032 SELECT t.table_name, c.column_name, c.column_default
3133 FROM information_schema.columns c
3234 JOIN information_schema.tables t ON c.table_name = t.table_name
3335 WHERE c.udt_name = 'statetype'
3436 AND t.table_schema = 'public'
3537 """
38+ )
3639 )
3740
3841 tables_columns = result .fetchall ()
3942
4043 # Update UNKNOWN states to FAILED in all affected tables
4144 for table_name , column_name , _ in tables_columns :
4245 op .execute (
43- f"""
46+ sa .DDL (
47+ f"""
4448 UPDATE { table_name }
4549 SET { column_name } = 'FAILED'
4650 WHERE { column_name } = 'UNKNOWN'
4751 """
52+ )
4853 )
Original file line number Diff line number Diff line change @@ -493,17 +493,17 @@ async def list_group_by_collection_run_id(
493493 total_count = await conn .scalar (count_query )
494494 items = []
495495 async for row in await conn .stream (list_query ):
496- db_states = [DB_TO_RUNNING_STATE [s ] for s in row [ " states" ] ]
496+ db_states = [DB_TO_RUNNING_STATE [s ] for s in row . states ]
497497 resolved_state = _resolve_grouped_state (db_states )
498498 items .append (
499499 ComputationCollectionRunRpcGet (
500- collection_run_id = row [ " collection_run_id" ] ,
501- project_ids = row [ " project_ids" ] ,
500+ collection_run_id = row . collection_run_id ,
501+ project_ids = row . project_ids ,
502502 state = resolved_state ,
503- info = {} if row [ " info" ] is None else row [ " info" ] ,
504- submitted_at = row [ " submitted_at" ] ,
505- started_at = row [ " started_at" ] ,
506- ended_at = row [ " ended_at" ] ,
503+ info = {} if row . info is None else row . info ,
504+ submitted_at = row . submitted_at ,
505+ started_at = row . started_at ,
506+ ended_at = row . ended_at ,
507507 )
508508 )
509509 return cast (int , total_count ), items
Original file line number Diff line number Diff line change @@ -956,8 +956,9 @@ async def test_list_group_by_collection_run_id_with_unknown_returns_unknown(
956956 )
957957
958958 # Test the function
959+ assert "product_name" in run_metadata
959960 total_count , items = await repo .list_group_by_collection_run_id (
960- product_name = run_metadata . get ( "product_name" ) ,
961+ product_name = run_metadata [ "product_name" ] ,
961962 user_id = published_project_1 .user ["id" ],
962963 offset = 0 ,
963964 limit = 10 ,
@@ -967,7 +968,7 @@ async def test_list_group_by_collection_run_id_with_unknown_returns_unknown(
967968 assert total_count == 1
968969 assert len (items ) == 1
969970 collection_item = items [0 ]
970- assert collection_item .state == RunningState .FAILED
971+ assert collection_item .state == RunningState .UNKNOWN
971972
972973
973974async def test_list_group_by_collection_run_id_with_project_filter (
You can’t perform that action at this time.
0 commit comments