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

Add events for upload start and end in cacholote #40

Merged
merged 3 commits into from
May 29, 2024
Merged
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
6 changes: 5 additions & 1 deletion cads_worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def wrapper(self, *args, session=None, **kwargs):
return wrapper


class Context:
class Context(cacholote.config.Context):
def __init__(
self,
job_id: str | None = None,
Expand Down Expand Up @@ -137,6 +137,9 @@ def add_stderr(
def session_maker(self) -> cads_broker.database.sa.orm.sessionmaker:
return create_session_maker()

def upload_log(self, *args, **kwargs):
self.add_stdout(*args, log_type="upload", **kwargs)

def info(self, *args, **kwargs):
self.add_stdout(*args, log_type="info", **kwargs)

Expand Down Expand Up @@ -189,6 +192,7 @@ def submit_workflow(
cache_db_urlpath=None,
create_engine_kwargs={},
sessionmaker=context.session_maker,
context=context,
)
adaptor_class = cads_adaptors.get_adaptor_class(entry_point, setup_code)
adaptor = adaptor_class(form=form, context=context, **config)
Expand Down
Loading