Update Python tools
This commit is contained in:
@@ -133,6 +133,21 @@ class RunStore:
|
||||
)
|
||||
return self.get(cursor.lastrowid, connection=connection), True
|
||||
|
||||
def set_input(
|
||||
self,
|
||||
run_id: int,
|
||||
input_data: Mapping[str, str | int | list[str]],
|
||||
) -> Run:
|
||||
input_json = json.dumps(input_data, sort_keys=True, separators=(",", ":"))
|
||||
with self._connect() as connection:
|
||||
connection.execute(
|
||||
"UPDATE runs SET input_json = ? WHERE id = ?",
|
||||
(input_json, run_id),
|
||||
)
|
||||
run = self.get(run_id, connection=connection)
|
||||
assert run is not None
|
||||
return run
|
||||
|
||||
def claim_next(self, queue_group: str) -> Run | None:
|
||||
with self._connect() as connection:
|
||||
connection.execute("BEGIN IMMEDIATE")
|
||||
|
||||
Reference in New Issue
Block a user