@@ -47,8 +47,9 @@ def run_cmd(ctx):
47
47
@click .option ("-p" , "--path" , required = True , help = "Path to package directory containing fedn.yaml" )
48
48
@click .option ("-i" , "--input" , required = True , help = "Path to input model" )
49
49
@click .option ("-o" , "--output" , required = True ,help = "Path to write the output JSON containing validation metrics" )
50
+ @click .option ("-v" , "--venv" , default = True ,type = bool ,required = False , help = "flag if set to False doesn't remove venv" )
50
51
@click .pass_context
51
- def validate_cmd (ctx , path ,input ,output ):
52
+ def validate_cmd (ctx , path ,input ,output , venv ):
52
53
"""Execute 'validate' entrypoint in fedn.yaml.
53
54
54
55
:param ctx:
@@ -70,17 +71,18 @@ def validate_cmd(ctx, path,input,output):
70
71
dispatcher = Dispatcher (config , path )
71
72
_ = dispatcher ._get_or_create_python_env ()
72
73
dispatcher .run_cmd ("validate {} {}" .format (input , output ))
73
-
74
- # delete the virtualenv
75
- if dispatcher .python_env_path :
76
- logger .info (f"Removing virtualenv { dispatcher .python_env_path } " )
77
- shutil .rmtree (dispatcher .python_env_path )
74
+ if venv :
75
+ # delete the virtualenv
76
+ if dispatcher .python_env_path :
77
+ logger .info (f"Removing virtualenv { dispatcher .python_env_path } " )
78
+ shutil .rmtree (dispatcher .python_env_path )
78
79
@run_cmd .command ("train" )
79
80
@click .option ("-p" , "--path" , required = True , help = "Path to package directory containing fedn.yaml" )
80
81
@click .option ("-i" , "--input" , required = True , help = "Path to input model parameters" )
81
82
@click .option ("-o" , "--output" , required = True ,help = "Path to write the updated model parameters " )
83
+ @click .option ("-v" , "--venv" , default = True ,type = bool ,required = False , help = "flag if set to False doesn't remove venv" )
82
84
@click .pass_context
83
- def train_cmd (ctx , path ,input ,output ):
85
+ def train_cmd (ctx , path ,input ,output , venv ):
84
86
"""Execute 'train' entrypoint in fedn.yaml.
85
87
86
88
:param ctx:
@@ -102,14 +104,14 @@ def train_cmd(ctx, path,input,output):
102
104
dispatcher = Dispatcher (config , path )
103
105
_ = dispatcher ._get_or_create_python_env ()
104
106
dispatcher .run_cmd ("train {} {}" .format (input , output ))
105
-
106
- # delete the virtualenv
107
- if dispatcher .python_env_path :
108
- logger .info (f"Removing virtualenv { dispatcher .python_env_path } " )
109
- shutil .rmtree (dispatcher .python_env_path )
107
+ if venv :
108
+ # delete the virtualenv
109
+ if dispatcher .python_env_path :
110
+ logger .info (f"Removing virtualenv { dispatcher .python_env_path } " )
111
+ shutil .rmtree (dispatcher .python_env_path )
110
112
@run_cmd .command ("startup" )
111
113
@click .option ("-p" , "--path" , required = True , help = "Path to package directory containing fedn.yaml" )
112
- @click .option ("-p " , "--venv" , default = True ,is_flag = True ,required = False , help = "flag if set to False doesn't remove venv" )
114
+ @click .option ("-v " , "--venv" , default = True ,type = bool ,required = False , help = "flag if set to False doesn't remove venv" )
113
115
@click .pass_context
114
116
def startup_cmd (ctx , path ,venv ):
115
117
"""Execute 'startup' entrypoint in fedn.yaml.
@@ -140,7 +142,7 @@ def startup_cmd(ctx, path,venv):
140
142
shutil .rmtree (dispatcher .python_env_path )
141
143
142
144
@run_cmd .command ("build" )
143
- @click .option ("-p " , "--venv" , default = True ,is_flag = True ,required = False , help = "flag if set to False doesn't remove venv" )
145
+ @click .option ("-v " , "--venv" , default = True ,type = bool ,required = False , help = "flag if set to False doesn't remove venv" )
144
146
@click .pass_context
145
147
def build_cmd (ctx , path ,venv ):
146
148
"""Execute 'build' entrypoint in fedn.yaml.
0 commit comments