@@ -287,7 +287,7 @@ fn train_joint(
287287} ;
288288
289289if deploy{
290- project. deploy ( model. id ) ;
290+ project. deploy ( model. id , Strategy :: new_score ) ;
291291} else {
292292warning ! ( "Not deploying newly trained model." ) ;
293293}
@@ -300,8 +300,40 @@ fn train_joint(
300300) ] )
301301}
302302
303- #[ pg_extern]
304- fn deploy (
303+ #[ pg_extern( name ="deploy" ) ]
304+ fn deploy_model (
305+ model_id : i64
306+ ) ->TableIterator <
307+ ' static ,
308+ (
309+ name ! ( project, String ) ,
310+ name ! ( strategy, String ) ,
311+ name ! ( algorithm, String ) ,
312+ ) ,
313+ > {
314+ let model =unwrap_or_error ! ( Model :: find_cached( model_id) ) ;
315+
316+ let project_id =Spi :: get_one_with_args :: < i64 > (
317+ "SELECT projects.id from pgml.projects JOIN pgml.models ON models.project_id = projects.id WHERE models.id = $1" ,
318+ vec ! [ ( PgBuiltInOids :: INT8OID . oid( ) , model_id. into_datum( ) ) ] ,
319+ )
320+ . unwrap ( ) ;
321+
322+ let project_id =
323+ project_id. unwrap_or_else ( ||error ! ( "Project does not exist." ) ) ;
324+
325+ let project =Project :: find ( project_id) . unwrap ( ) ;
326+ project. deploy ( model_id, Strategy :: specific) ;
327+
328+ TableIterator :: new ( vec ! [ (
329+ project. name,
330+ Strategy :: specific. to_string( ) ,
331+ model. algorithm. to_string( ) ,
332+ ) ] )
333+ }
334+
335+ #[ pg_extern( name ="deploy" ) ]
336+ fn deploy_strategy (
305337project_name : & str ,
306338strategy : Strategy ,
307339algorithm : default ! ( Option <Algorithm >, "NULL" ) ,
@@ -378,7 +410,7 @@ fn deploy(
378410let algorithm = algorithm. expect ( "No qualified models exist for this deployment." ) ;
379411
380412let project =Project :: find ( project_id) . unwrap ( ) ;
381- project. deploy ( model_id) ;
413+ project. deploy ( model_id, strategy ) ;
382414
383415TableIterator :: new ( vec ! [ (
384416 project_name. to_string( ) ,
@@ -922,7 +954,7 @@ fn tune(
922954} ;
923955
924956if deploy{
925- project. deploy ( model. id ) ;
957+ project. deploy ( model. id , Strategy :: new_score ) ;
926958}
927959
928960TableIterator :: new ( vec ! [ (