File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,16 @@ def _get_required_option(ctx: click.Context, name: str) -> object:
152
152
return value
153
153
154
154
155
+ def _prepare_click_context (f : click .Command , params : dict ) -> click .Context :
156
+ """create new click context for invoking a command via f.invoke(ctx)"""
157
+ current_ctx = click .get_current_context ()
158
+ current_obj = current_ctx .find_root ().obj
159
+
160
+ ctx = click .Context (f , obj = current_obj )
161
+ ctx .params = params
162
+ return ctx
163
+
164
+
155
165
def _log_level_option (f : Callable [..., object ]) -> Callable [..., object ]:
156
166
return click .option (
157
167
"--log" ,
@@ -1720,19 +1730,18 @@ def deploy_checkpoints(
1720
1730
),
1721
1731
)
1722
1732
1723
- ctx = click .Context (push , obj = {})
1724
- ctx .params = {
1733
+ params = {
1725
1734
"target_directory" : prepare_checkpoint_result .truss_directory ,
1726
1735
"remote" : remote ,
1727
1736
"model_name" : prepare_checkpoint_result .checkpoint_deploy_config .model_name ,
1728
1737
"publish" : True ,
1729
1738
"deployment_name" : prepare_checkpoint_result .checkpoint_deploy_config .deployment_name ,
1730
1739
}
1740
+ ctx = _prepare_click_context (push , params )
1731
1741
if dry_run :
1732
1742
console .print ("--dry-run flag provided, not deploying" , style = "yellow" )
1733
1743
else :
1734
1744
push .invoke (ctx )
1735
-
1736
1745
train_cli .print_deploy_checkpoints_success_message (prepare_checkpoint_result )
1737
1746
1738
1747
You can’t perform that action at this time.
0 commit comments