Skip to content

Commit

Permalink
add samples_last_modified to instance; use it in worker;
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesrichter committed Jun 26, 2023
1 parent 6e8fc11 commit 8c072e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions koi_core/api/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"finalized": "finalized",
"could_train": "could_train",
"last_modified": "last_modified",
"samples_last_modified": "samples_last_modified",
}


Expand Down Expand Up @@ -96,9 +97,6 @@ def get_instance_training_data(self, id: InstanceId, meta: CachingMeta):
def set_instance_training_data(self, id: InstanceId, data: bytes):
self.base._POST_raw(self.base._build_path(id) + "/training", data=data)

# endregion

# region descriptor
def get_descriptors(self, id: InstanceId, meta: CachingMeta = None):
data, meta = self.base._GET(self.base._build_path(id) + "/descriptor")
return (
Expand Down
2 changes: 1 addition & 1 deletion koi_core/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def main():
continue

# seconds since last instance update
last_modified = datetime.fromisoformat(instance.last_modified)
last_modified = datetime.fromisoformat(instance.samples_last_modified)
sec_since_last_change = (datetime.utcnow() - last_modified).total_seconds()

Check warning on line 208 in koi_core/worker.py

View check run for this annotation

Codecov / codecov/patch

koi_core/worker.py#L207-L208

Added lines #L207 - L208 were not covered by tests
# train the instance if its ready to train or the user forces it
if opt.force or (instance.could_train and sec_since_last_change > opt.wait_training):
Expand Down

0 comments on commit 8c072e8

Please sign in to comment.