Skip to content

Commit 2dd7cb8

Browse files
committed
Move rebuild jobs index
1 parent e07bae5 commit 2dd7cb8

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "transformerlab"
7-
version = "0.0.31"
7+
version = "0.0.32"
88
description = "Python SDK for Transformer Lab"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/lab/experiment.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)