File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -204,13 +204,22 @@ def create_performance_definition(
204
204
205
205
# Separate single models from multiple models
206
206
if not isinstance (models , list ):
207
- models = mr .get_model (models )
207
+ models = [models ]
208
+ if project :
209
+ project = mr .get_project (project )
210
+ project_models = mr .get (f'/projects/{ project .id } /models' )
211
+ project_models = [m for m in project_models if m .name in models ]
212
+ models = project_models
213
+ # Necessary to eventually provide variables to the performance definition
214
+ models [0 ] = mr .get_model (project_models [0 ].id )
208
215
else :
209
216
# Collect all models into a list. This converts the PagedList response from mr.list_models to a normal list.
210
217
for i , model in enumerate (models ):
211
218
models [i ] = mr .get_model (model )
212
- if not project :
213
219
project = mr .get_project (models [0 ].projectId )
220
+ # Ensures that all models are in the same project
221
+ if not all ([model .projectId == project .id for model in models ]):
222
+ raise ValueError ("Not all models are contained within the same project. Try specifying a project." )
214
223
215
224
# Performance data cannot be captured unless certain project properties have been configured.
216
225
for required in ["targetVariable" , "targetLevel" ]:
You can’t perform that action at this time.
0 commit comments