@@ -558,32 +558,6 @@ def try_get_features2():
558558 )
559559
560560
561- @pytest .mark .timeout (300 )
562- @pytest .mark .run (order = 19 )
563- def test_basic_ingest_jobs (client ):
564- # list ingestion jobs given featureset
565- cust_trans_fs = client .get_feature_set (name = "customer_transactions" )
566- ingest_jobs = client .list_ingest_jobs (
567- feature_set_ref = FeatureSetRef .from_feature_set (cust_trans_fs )
568- )
569- # filter ingestion jobs to only those that are running
570- ingest_jobs = [
571- job for job in ingest_jobs if job .status == IngestionJobStatus .RUNNING
572- ]
573- assert len (ingest_jobs ) >= 1
574-
575- for ingest_job in ingest_jobs :
576- # restart ingestion ingest_job
577- client .restart_ingest_job (ingest_job )
578- ingest_job .wait (IngestionJobStatus .RUNNING )
579- assert ingest_job .status == IngestionJobStatus .RUNNING
580-
581- # stop ingestion ingest_job
582- client .stop_ingest_job (ingest_job )
583- ingest_job .wait (IngestionJobStatus .ABORTED )
584- assert ingest_job .status == IngestionJobStatus .ABORTED
585-
586-
587561@pytest .fixture (scope = "module" )
588562def all_types_dataframe ():
589563 return pd .DataFrame (
@@ -762,16 +736,33 @@ def test_all_types_ingest_jobs(client, all_types_dataframe):
762736 ]
763737 assert len (ingest_jobs ) >= 1
764738
765- for ingest_job in ingest_jobs :
766- # restart ingestion ingest_job
767- client .restart_ingest_job (ingest_job )
768- ingest_job .wait (IngestionJobStatus .RUNNING )
769- assert ingest_job .status == IngestionJobStatus .RUNNING
739+ ingest_job = ingest_jobs [0 ]
740+ # restart ingestion ingest_job
741+ # restart means stop current job
742+ # (replacement will be automatically spawned)
743+ client .restart_ingest_job (ingest_job )
744+ # wait for replacement to be created
745+ time .sleep (15 ) # should be more than polling_interval
746+
747+ # id without timestamp part
748+ # that remains the same between jobs
749+ shared_id = "-" .join (ingest_job .id .split ("-" )[:- 1 ])
750+ replacement_jobs = [
751+ job
752+ for job in ingest_jobs
753+ if job .status == IngestionJobStatus .RUNNING and job .id .startswith (shared_id )
754+ ]
770755
771- # stop ingestion ingest_job
772- client .stop_ingest_job (ingest_job )
773- ingest_job .wait (IngestionJobStatus .ABORTED )
774- assert ingest_job .status == IngestionJobStatus .ABORTED
756+ assert len (replacement_jobs ) >= 1
757+ replacement_job = replacement_jobs [0 ]
758+
759+ replacement_job .wait (IngestionJobStatus .RUNNING )
760+ assert replacement_job .status == IngestionJobStatus .RUNNING
761+
762+ # stop ingestion ingest_job
763+ client .stop_ingest_job (replacement_job )
764+ replacement_job .wait (IngestionJobStatus .ABORTED )
765+ assert replacement_job .status == IngestionJobStatus .ABORTED
775766
776767
777768@pytest .fixture (scope = "module" )
0 commit comments