Skip to content

Commit 591f8ce

Browse files
committed
Deprecate Productions Table
1 parent 42edec0 commit 591f8ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+221
-664
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""Deprecate Productions
2+
3+
Revision ID: 7bac827dd8cb
4+
Revises: cef0ebaa8241
5+
Create Date: 2025-03-18 21:14:09.976660+00:00
6+
7+
"""
8+
9+
from collections.abc import Sequence
10+
11+
from alembic import op
12+
13+
# revision identifiers, used by Alembic.
14+
revision: str = "7bac827dd8cb"
15+
down_revision: str | None = "cef0ebaa8241"
16+
branch_labels: str | Sequence[str] | None = None
17+
depends_on: str | Sequence[str] | None = None
18+
19+
20+
def upgrade() -> None:
21+
# Remove production-related indexes
22+
op.drop_index(op.f("ix_campaign_parent_id"), table_name="campaign", if_exists=True)
23+
op.drop_index(op.f("ix_production_name"), table_name="production", if_exists=True)
24+
25+
# Remove FK constraint and parent id column from campaigns table
26+
op.drop_constraint(constraint_name="campaign_parent_id_fkey", table_name="campaign", type_="foreignkey")
27+
op.drop_column(table_name="campaign", column_name="parent_id")
28+
29+
# Drop the productions table
30+
op.drop_table("production", if_exists=True)
31+
32+
33+
def downgrade() -> None: ...

alembic/versions/92053b1ad093_separate_out_most_tables_and_indices_v0_1_4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def downgrade() -> None:
8888
op.drop_index(op.f("ix_step_name"), table_name="step")
8989
op.drop_index(op.f("ix_campaign_spec_id"), table_name="campaign")
9090
op.drop_index(op.f("ix_campaign_spec_block_id"), table_name="campaign")
91-
op.drop_index(op.f("ix_campaign_parent_id"), table_name="campaign")
91+
op.drop_index(op.f("ix_campaign_parent_id"), table_name="campaign", if_exists=True)
9292
op.drop_index(op.f("ix_campaign_name"), table_name="campaign")
9393
op.drop_index(op.f("ix_specification_name"), table_name="specification")
9494
op.drop_index(op.f("ix_spec_block_name"), table_name="spec_block")
95-
op.drop_index(op.f("ix_production_name"), table_name="production")
95+
op.drop_index(op.f("ix_production_name"), table_name="production", if_exists=True)

src/lsst/cmservice/cli/campaign.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def campaign_group() -> None:
2525
options.collections(),
2626
options.spec_aliases(),
2727
options.handler(),
28-
options.parent_name(),
2928
options.spec_name(),
3029
options.spec_block_name(),
3130
options.spec_block_assoc_name(),
@@ -88,8 +87,6 @@ def action() -> None:
8887

8988
get_row_by_fullname = wrappers.get_row_by_fullname_command(get_command, sub_client, DbClass)
9089

91-
get_parent = wrappers.get_element_parent_command(get_command, sub_client, db.Production)
92-
9390
get_spec_block = wrappers.get_spec_block_command(get_command, sub_client)
9491

9592
get_specification = wrappers.get_specification_command(get_command, sub_client)

src/lsst/cmservice/cli/client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from .pipetask_error import pipetask_error_group
1010
from .pipetask_error_type import pipetask_error_type_group
1111
from .product_set import product_set_group
12-
from .production import production_group
1312
from .queue import queue_group
1413
from .script import script_group
1514
from .script_dependency import script_dependency_group
@@ -34,7 +33,6 @@
3433
pipetask_error_group,
3534
pipetask_error_type_group,
3635
product_set_group,
37-
production_group,
3836
queue_group,
3937
script_group,
4038
script_dependency_group,

src/lsst/cmservice/cli/production.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/lsst/cmservice/cli/queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ def daemon(
6464
client: CMClient,
6565
row_id: int,
6666
) -> None:
67-
"""Update a production"""
67+
"""Update a queue"""
6868
client.queue.daemon(row_id)

src/lsst/cmservice/client/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from .pipetask_error_types import CMPipetaskErrorTypeClient
2828
from .pipetask_errors import CMPipetaskErrorClient
2929
from .product_sets import CMProductSetClient
30-
from .productions import CMProductionClient
3130
from .queues import CMQueueClient
3231
from .script_dependencies import CMScriptDependencyClient
3332
from .script_errors import CMScriptErrorClient
@@ -49,7 +48,6 @@
4948
"CMPipetaskErrorTypeClient",
5049
"CMPipetaskErrorClient",
5150
"CMProductSetClient",
52-
"CMProductionClient",
5351
"CMQueueClient",
5452
"CMScriptDependencyClient",
5553
"CMScriptErrorClient",

src/lsst/cmservice/client/client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from .pipetask_error_types import CMPipetaskErrorTypeClient
1616
from .pipetask_errors import CMPipetaskErrorClient
1717
from .product_sets import CMProductSetClient
18-
from .productions import CMProductionClient
1918
from .queues import CMQueueClient
2019
from .script_dependencies import CMScriptDependencyClient
2120
from .script_errors import CMScriptErrorClient
@@ -48,7 +47,6 @@ def __init__(self: CMClient) -> None:
4847
client_kwargs["cookies"] = cookies
4948
self._client = httpx.Client(**client_kwargs)
5049

51-
self.production = CMProductionClient(self)
5250
self.campaign = CMCampaignClient(self)
5351
self.step = CMStepClient(self)
5452
self.group = CMGroupClient(self)

src/lsst/cmservice/client/loaders.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -284,22 +284,9 @@ def campaign_cl(
284284
with open(campaign_yaml, encoding="utf-8") as fin:
285285
config_data = yaml.safe_load(fin)
286286

287-
try:
288-
prod_config = config_data["Production"]
289-
except KeyError as msg:
290-
raise CMYamlParseError(
291-
f"Could not find 'Production' tag in {campaign_yaml}",
292-
) from msg
293-
try:
294-
parent_name = prod_config["name"]
295-
except KeyError as msg:
296-
raise CMYamlParseError(
297-
f"Could not find 'name' tag in {campaign_yaml}#Production",
298-
) from msg
299-
300287
try:
301288
camp_config = config_data["Campaign"]
302-
camp_config["parent_name"] = parent_name
289+
camp_config["parent_name"] = "DEFAULT"
303290
except KeyError as msg:
304291
raise CMYamlParseError(
305292
f"Could not find 'Campaign' tag in {campaign_yaml}",
@@ -308,7 +295,7 @@ def campaign_cl(
308295
assert isinstance(camp_config, dict)
309296

310297
# flush out config_data with kwarg overrides
311-
for key in ["name", "parent_name", "spec_name", "handler"]:
298+
for key in ["name", "spec_name", "handler"]:
312299
val = kwargs.get(key, None)
313300
if val:
314301
camp_config[key] = val
@@ -332,10 +319,6 @@ def campaign_cl(
332319
else:
333320
self.specification_cl(yaml_file, allow_update=allow_update)
334321

335-
production = self._parent.production.get_row_by_name(parent_name)
336-
if not production: # pragma: no cover
337-
self._parent.production.create(name=parent_name)
338-
339322
spec_name = camp_config["spec_name"]
340323
camp_config["spec_block_assoc_name"] = f"{spec_name}#campaign"
341324

src/lsst/cmservice/client/productions.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)