NotebookRunner#
- class mobu.services.business.notebookrunner.NotebookRunner(*, options, user, repo_manager, events, logger, flock)#
Bases:
ABC
,NubladoBusiness
,Generic
Start a Jupyter lab and run a sequence of notebooks.
- Parameters:
options (
TypeVar
(T
, bound=NotebookRunnerOptions
)) – Configuration options for the business.user (
AuthenticatedUser
) – User with their authentication token to use to run the business.events (
Events
) – Event publishers.logger (
BoundLogger
) – Logger to use to report the results of business.flock (
str
|None
) – Flock that is running this business, if it is running in a flock.repo_manager (
RepoManager
)
Methods Summary
cleanup
()Return notebook event attrs with the other common attrs.
dump
()execute_cell
(session, code, cell_id, context)execute_code
(session)Run a set number of notebooks (flocks), or all available (CI).
execute_notebook
(session, iteration)Return an iterator to control sets of code executions.
Prepare to run the business.
Pause between each notebook execution.
open_session
([notebook_name])Override to add the notebook name.
read_notebook
(notebook)refresh
()shutdown
()Perform any cleanup required after stopping.
startup
()Run before the start of the first iteration and then not again.
trace_notebook
(notebook, iteration)Set up tracing context for executing a notebook.
Methods Documentation
- common_notebook_event_attrs()#
Return notebook event attrs with the other common attrs.
- Return type:
_CommonNotebookEventAttrs
- dump()#
- Return type:
- async execute_cell(session, code, cell_id, context)#
- async execute_code(session)#
Run a set number of notebooks (flocks), or all available (CI).
- Parameters:
session (
JupyterLabSession
)- Return type:
- async execute_notebook(session, iteration)#
- abstract execution_iterator()#
Return an iterator to control sets of code executions.
- Return type:
- async initialize()#
Prepare to run the business. :rtype:
None
Get notebook repo files from the repo manager
Parse the in-repo config
Filter the notebooks
- next_notebook()#
- Return type:
Path
- open_session(notebook_name=None)#
Override to add the notebook name.
- Parameters:
- Return type:
AsyncGenerator
[JupyterLabSession
]