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

doc: Fixup references #286

Merged
merged 1 commit into from
Jun 10, 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
5 changes: 4 additions & 1 deletion docs/guides/scheduling.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ However, there are more explicit methods.

```python exec="true" source="material-block" html="True" hl_lines="20"
import time
from asyncio import Future

from amltk.scheduling import Scheduler

scheduler = Scheduler.with_processes(1)
Expand All @@ -437,7 +439,7 @@ However, there are more explicit methods.
def submit_calculations() -> None:
scheduler.submit(expensive_function)

# The will endlessly loop the scheduler
# This will endlessly loop the scheduler
@scheduler.on_future_done
def submit_again(future: Future) -> None:
if scheduler.running():
Expand Down Expand Up @@ -468,6 +470,7 @@ the default, but it also takes three other possibilities:
One example is to just `stop()` the scheduler when some exception occurs.

```python exec="true" source="material-block" html="True" hl_lines="12-15"
from asyncio import Future
from amltk.scheduling import Scheduler

scheduler = Scheduler.with_processes(1)
Expand Down
2 changes: 1 addition & 1 deletion docs/hooks/cleanup_log_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import mkdocs.plugins
import mkdocs.structure.pages

from amltk.exceptions import AutomaticParameterWarning, TaskTypeWarning
from amltk.exceptions import AutomaticParameterWarning

log = logging.getLogger("mkdocs")

Expand Down
11 changes: 1 addition & 10 deletions docs/hooks/debug_which_page_is_being_rendered.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@
import mkdocs
import mkdocs.plugins
import mkdocs.structure.pages
import os

log = logging.getLogger("mkdocs")

RENDER_EXAMPLES_ENV_VAR = "AMLTK_DOC_RENDER_EXAMPLES"
EXEC_DOCS_ENV_VAR = "AMLTK_EXEC_DOCS"

truthy_values = {"yes", "on", "true", "1", "all"}

def on_pre_page(
page: mkdocs.structure.pages.Page,
config: Any,
files: Any,
) -> mkdocs.structure.pages.Page | None:
render_examples = os.environ.get(RENDER_EXAMPLES_ENV_VAR, "true")
render_code = os.environ.get(EXEC_DOCS_ENV_VAR, "true")
if render_examples.lower() in truthy_values or render_code.lower() in truthy_values:
log.info(f"{page.file.src_path}")
log.info(f"{page.file.src_path}")
4 changes: 2 additions & 2 deletions docs/hooks/disable_markdown_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
logger = logging.getLogger("mkdocs")


def _print_msg(compiled_code: Any, exec_globals: dict) -> None:
def _print_msg(compiled_code: Any, code_block_id: int, exec_globals: dict) -> None:
_print = exec_globals["print"]
_print(
f"Env variable {RUN_CODE_BLOCKS_ENV_VAR}=0 - No code to display."
Expand All @@ -42,5 +42,5 @@ def on_startup(**kwargs: Any):
)
from markdown_exec.formatters import python

setattr(python, "exec", _print_msg)
setattr(python, "exec_python", _print_msg)

Loading