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 mock_modules for import x.y.z as a #321

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions clu/periodic_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import collections
import concurrent.futures
import contextlib
import functools
import os
import time
from typing import Callable, Iterable, Optional, Sequence
Expand Down Expand Up @@ -410,15 +411,18 @@ def _apply(self, step: int, t: float):
def _start_session(self):
profiler.collect(
logdir=self._logdir,
callback=self._end_session,
# Callback is executed asynchronously, so bind `self._previous_step`
callback=functools.partial(self._end_session, step=self._previous_step),
hosts=self._hosts,
duration_ms=self._profile_duration_ms)
duration_ms=self._profile_duration_ms,
)

def _end_session(self, url: Optional[str]):
def _end_session(self, url: Optional[str], *, step: int):
platform.work_unit().create_artifact(
platform.ArtifactType.URL,
url,
description=f"[{self._previous_step}] Profile")
description=f"[{step}] Profile",
)


class PeriodicCallback(PeriodicAction):
Expand Down
Loading