Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update superduper job_id after submission #2420

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optimize the logic for file saving and retrieval in the artifact_store.
- Add backfill on load of vector index
- Add startup event to initialize db.apply jobs
- Update job_id after job submission

#### New Features & Functionality

Expand Down
4 changes: 2 additions & 2 deletions superduper/backends/local/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def broadcast(self, events: t.List):

def submit(
self, function: t.Callable, *args, compute_kwargs: t.Dict = {}, **kwargs
) -> t.Tuple[str, str]:
) -> str:
"""
Submits a function for local execution.

Expand All @@ -73,7 +73,7 @@ def submit(
logging.success(
f"Job submitted on {self}. function:{function} future:{future_key}"
)
return future_key, future_key
return future_key

@property
def tasks(self) -> t.Dict[str, t.Any]:
Expand Down
10 changes: 7 additions & 3 deletions superduper/jobs/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def watch(self):
return self.db.metadata.watch_job(identifier=self.identifier)

@abstractmethod
def submit(self, compute, dependencies=(), update_job=True):
def submit(self, compute, dependencies=()):
"""Submit job for execution.

:param compute: compute engine
Expand Down Expand Up @@ -124,7 +124,7 @@ def dict(self):
d['_path'] = f'superduper/jobs/job/FunctionJob/{path}'
return d

def submit(self, dependencies=(), update_job=True):
def submit(self, dependencies=()):
"""Submit job for execution.

:param dependencies: list of dependencies
Expand Down Expand Up @@ -153,9 +153,11 @@ def __call__(self, db: t.Union['Datalayer', None], dependencies=()):
db = build_datalayer()

self.db = db
db.metadata.create_job(self.dict())

db.metadata.create_job(self.dict())
self.submit(dependencies=dependencies)
if self.future:
db.metadata.update_job(self.job_id, 'job_id', self.future)

return self

Expand Down Expand Up @@ -245,6 +247,8 @@ def __call__(self, db: t.Union['Datalayer', None] = None, dependencies=()):
db.metadata.create_job(self.dict())

self.submit(dependencies=dependencies)
if self.future:
db.metadata.update_job(self.job_id, 'job_id', self.future)
return

def dict(self):
Expand Down
Loading