@@ -116,6 +116,9 @@ def create_job(self):
116116 new_job = Job .create (new_job_id )
117117 new_job .set_experiment (self .id )
118118
119+ # Update jobs index now that a new job exists
120+ self .rebuild_jobs_index ()
121+
119122 return new_job
120123
121124 def get_jobs (self , type : str = "" , status : str = "" ):
@@ -124,11 +127,6 @@ def get_jobs(self, type: str = "", status: str = ""):
124127 type: If not blank, filter by jobs with this type.
125128 status: If not blank, filter by jobs with this status.
126129 """
127-
128- # Rebuild the index
129- # TODO: The point of the index is to not do this every time
130- self .rebuild_jobs_index ()
131-
132130 # First get jobs of the passed type
133131 job_list = []
134132 if type :
@@ -145,7 +143,6 @@ def get_jobs(self, type: str = "", status: str = ""):
145143 job_json = job .get_json_data ()
146144 except Exception :
147145 continue
148-
149146 # Filter for status
150147 if status and (job_json .get ("status" , "" ) != status ):
151148 continue
@@ -157,7 +154,7 @@ def get_jobs(self, type: str = "", status: str = ""):
157154 # If it passed filters then add as long as it has job_data
158155 if "job_data" in job_json :
159156 results .append (job_json )
160-
157+
161158 return results
162159
163160 ###############################
0 commit comments