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

Fix broken function call reset_static_definition #438

Merged
merged 1 commit into from
Oct 16, 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
2 changes: 1 addition & 1 deletion src/saturn_engine/worker/worker_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(

self.context = WorkerManagerContext(config=config.c.worker_manager)
with self.sessionmaker() as session:
self.context.reset_static_definition(session=session)
self.context.load_static_definition(session=session)

async def init_db(self) -> None:
return await asyncio.get_event_loop().run_in_executor(
Expand Down
5 changes: 2 additions & 3 deletions src/saturn_engine/worker_manager/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ def __init__(self, config: WorkerManagerConfig) -> None:

@property
def static_definitions(self) -> StaticDefinitions:
assert (
self._static_definitions
), "Static definitions need to be set before usage"
if not self._static_definitions:
raise ValueError("Static definitions need to be set before usage")
return self._static_definitions

def load_static_definition(self, session: AnySession) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/saturn_engine/worker_manager/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def init_all(app: Optional[SaturnApp] = None) -> None:
with app.app_context():
create_all()
with session_scope() as session:
current_app.saturn.reset_static_definition(session=session)
current_app.saturn.load_static_definition(session=session)
sync_jobs(
static_definitions=current_app.saturn.static_definitions,
session=session,
Expand Down
Loading