Skip to content

Commit da04997

Browse files
committed
feat(campaign): Use namespaced names for campaign specblocks
1 parent c5cc5cd commit da04997

File tree

17 files changed

+275
-245
lines changed

17 files changed

+275
-245
lines changed

src/lsst/cmservice/cli/load.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
from .. import db
66
from ..client.client import CMClient
7+
from ..common.logging import LOGGER
78
from . import options
89
from .wrappers import output_pydantic_list, output_pydantic_object
910

11+
logger = LOGGER.bind(module=__name__)
12+
1013

1114
@click.group(name="load")
1215
def load_group() -> None:
@@ -17,14 +20,14 @@ def load_group() -> None:
1720
@options.cmclient()
1821
@options.output()
1922
@options.yaml_file()
23+
@options.namespace()
2024
@options.allow_update()
2125
def specification(
2226
client: CMClient,
2327
output: options.OutputEnum | None,
2428
**kwargs: Any,
2529
) -> None:
2630
"""Load a Specification from a yaml file"""
27-
2831
result = client.load.specification_cl(**kwargs)
2932
specifications = result.get("Specification", [])
3033
spec_blocks = result.get("SpecBlock", [])
@@ -43,24 +46,17 @@ def specification(
4346
@options.output()
4447
@options.campaign_yaml()
4548
@options.yaml_file()
46-
@options.name()
47-
@options.parent_name()
48-
@options.spec_name()
49-
@options.spec_block_name()
50-
@options.handler()
51-
@options.data()
52-
@options.child_config()
53-
@options.collections()
54-
@options.spec_aliases()
55-
@options.allow_update()
5649
def campaign(
5750
client: CMClient,
5851
output: options.OutputEnum | None,
5952
**kwargs: Any,
6053
) -> None:
6154
"""Load a Specification from a yaml file and make a Campaign"""
62-
result = client.load.campaign_cl(**kwargs)
63-
output_pydantic_object(result, output, db.Campaign.col_names_for_table)
55+
try:
56+
result = client.load.campaign_cl(**kwargs)
57+
output_pydantic_object(result, output, db.Campaign.col_names_for_table)
58+
except Exception:
59+
logger.exception()
6460

6561

6662
@load_group.command()

src/lsst/cmservice/cli/options.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from ..client.client import CMClient
1010
from ..common.enums import (
11+
DEFAULT_NAMESPACE,
1112
ErrorActionEnum,
1213
ErrorFlavorEnum,
1314
ErrorSourceEnum,
@@ -40,6 +41,7 @@
4041
"handler",
4142
"n_expected",
4243
"name",
44+
"namespace",
4345
"node_type",
4446
"parent_name",
4547
"parent_id",
@@ -190,7 +192,7 @@ class OutputEnum(Enum):
190192
campaign_yaml = PartialOption(
191193
"--campaign_yaml",
192194
type=str,
193-
help="Path to campaign yaml file",
195+
help="Path to campaign yaml ('start') file",
194196
)
195197

196198

@@ -339,6 +341,14 @@ class OutputEnum(Enum):
339341
name = PartialOption("--name", type=str, help="Name of object")
340342

341343

344+
namespace = PartialOption(
345+
"--namespace",
346+
type=click.UUID,
347+
default=DEFAULT_NAMESPACE,
348+
help="Namespace for objects",
349+
)
350+
351+
342352
node_type = PartialOption(
343353
"--node_type",
344354
type=EnumChoice(NodeTypeEnum),
@@ -483,7 +493,7 @@ class OutputEnum(Enum):
483493
yaml_file = PartialOption(
484494
"--yaml_file",
485495
type=str,
486-
help="Path to yaml file",
496+
help="Path to yaml file containing spec blocks and other specifications or manifests",
487497
)
488498

489499

0 commit comments

Comments
 (0)