86
86
]
87
87
}
88
88
89
-
90
89
console = Console ()
91
90
92
91
error_console = Console (stderr = True , style = "bold red" )
@@ -555,11 +554,15 @@ def _create_chains_table(service) -> Tuple[rich.table.Table, List[str]]:
555
554
help = "Name of the remote in .trussrc to push to." ,
556
555
)
557
556
@click .option (
558
- "--user_env" ,
559
- required = False ,
557
+ "--experimental-watch-chainlet-names" ,
560
558
type = str ,
561
- help = "[DEPRECATED], use ``environment`` instead." ,
562
- hidden = True ,
559
+ required = False ,
560
+ help = (
561
+ "Runs `watch`, but only applies patches to specified chainlets. The option is "
562
+ "a comma-separated list of chainlet (display) names. This option can give "
563
+ "faster dev loops, but also lead to inconsistent deployments. Use with caution "
564
+ "and refer to docs."
565
+ ),
563
566
)
564
567
@log_level_option
565
568
@error_handling
@@ -572,9 +575,9 @@ def push_chain(
572
575
wait : bool ,
573
576
watch : bool ,
574
577
dryrun : bool ,
575
- user_env : Optional [str ],
576
578
remote : Optional [str ],
577
579
environment : Optional [str ],
580
+ experimental_watch_chainlet_names : Optional [str ],
578
581
) -> None :
579
582
"""
580
583
Deploys a chain remotely.
@@ -589,6 +592,9 @@ def push_chain(
589
592
from truss_chains import framework
590
593
from truss_chains .deployment import deployment_client
591
594
595
+ if experimental_watch_chainlet_names :
596
+ watch = True
597
+
592
598
if watch :
593
599
if publish or promote :
594
600
raise ValueError (
@@ -600,13 +606,10 @@ def push_chain(
600
606
)
601
607
wait = True
602
608
603
- if user_env :
604
- raise ValueError ("`user_env` is deprecated, use `environment` instead." )
605
-
606
609
if promote and environment :
607
610
promote_warning = (
608
611
"`promote` flag and `environment` flag were both specified. "
609
- "Ignoring the value of `promote`"
612
+ "Ignoring the value of `promote`. "
610
613
)
611
614
console .print (promote_warning , style = "yellow" )
612
615
@@ -674,7 +677,14 @@ def push_chain(
674
677
)
675
678
console .print (deploy_success_text , style = "bold green" )
676
679
console .print (f"You can run the chain with:\n { curl_snippet } " )
680
+
677
681
if watch : # Note that this command will print a startup message.
682
+ if experimental_watch_chainlet_names :
683
+ included_chainlets = [
684
+ x .strip () for x in experimental_watch_chainlet_names .split ("," )
685
+ ]
686
+ else :
687
+ included_chainlets = None
678
688
deployment_client .watch (
679
689
source ,
680
690
entrypoint ,
@@ -683,6 +693,7 @@ def push_chain(
683
693
console ,
684
694
error_console ,
685
695
show_stack_trace = not is_humanfriendly_log_level ,
696
+ included_chainlets = included_chainlets ,
686
697
)
687
698
else :
688
699
console .print (f"Deployment failed ({ num_failed } failures)." , style = "red" )
@@ -710,20 +721,24 @@ def push_chain(
710
721
help = "Name of the remote in .trussrc to push to." ,
711
722
)
712
723
@click .option (
713
- "--user_env" ,
714
- required = False ,
724
+ "--experimental-chainlet-names" ,
715
725
type = str ,
716
- help = "[DEPRECATED], use `environment` instead." ,
717
- hidden = True ,
726
+ required = False ,
727
+ help = (
728
+ "Runs `watch`, but only applies patches to specified chainlets. The option is "
729
+ "a comma-separated list of chainlet (display) names. This option can give "
730
+ "faster dev loops, but also lead to inconsistent deployments. Use with caution "
731
+ "and refer to docs."
732
+ ),
718
733
)
719
734
@log_level_option
720
735
@error_handling
721
736
def watch_chains (
722
737
source : Path ,
723
738
entrypoint : Optional [str ],
724
739
name : Optional [str ],
725
- user_env : Optional [str ],
726
740
remote : Optional [str ],
741
+ experimental_chainlet_names : Optional [str ],
727
742
) -> None :
728
743
"""
729
744
Watches the chains source code and applies live patches to a development deployment.
@@ -738,12 +753,14 @@ def watch_chains(
738
753
# These imports are delayed, to handle pydantic v1 envs gracefully.
739
754
from truss_chains .deployment import deployment_client
740
755
741
- if user_env :
742
- raise ValueError ("`user_env` is deprecated, use `environment` instead." )
743
-
744
756
if not remote :
745
757
remote = inquire_remote_name (RemoteFactory .get_available_config_names ())
746
758
759
+ if experimental_chainlet_names :
760
+ included_chainlets = [x .strip () for x in experimental_chainlet_names .split ("," )]
761
+ else :
762
+ included_chainlets = None
763
+
747
764
deployment_client .watch (
748
765
source ,
749
766
entrypoint ,
@@ -752,6 +769,7 @@ def watch_chains(
752
769
console ,
753
770
error_console ,
754
771
show_stack_trace = not is_humanfriendly_log_level ,
772
+ included_chainlets = included_chainlets ,
755
773
)
756
774
757
775
0 commit comments