String Based API
The string‑based API is implemented by PerfmonitorMagicAdapter in jumper_extension.core.service. It provides a thin layer that:
- Accepts command‑line style strings (as used by IPython magics).
- Parses arguments using
ArgParsersbuilt from the core parser utilities. - Delegates the resulting structured options to methods on
PerfmonitorService.
This layer is also used by the notebook script writer when generating reproducible monitoring scripts.
Role in the public API
At runtime, the flow of a typical command is:
- IPython calls the appropriate method on
PerfmonitorMagics(for exampleperfmonitor_perfreport). PerfmonitorMagicsforwards the rawlinestring to the corresponding method onPerfmonitorMagicAdapter.PerfmonitorMagicAdapterparses the string with the relevant parser (for exampleparsers.perfreport) and calls the corresponding method onPerfmonitorService.
This design keeps the parsing and text handling logic separate from the core monitoring and analysis code.
Example usage
While you typically interact with the string‑based API indirectly through magics, you can also construct it directly:
from jumper_extension.core.service import build_perfmonitor_magic_adapter
adapter = build_perfmonitor_magic_adapter()
adapter.perfmonitor_start("1.0")
adapter.perfmonitor_perfreport("--cell 2:5 --level user")
adapter.perfmonitor_export_perfdata("--file perf.csv --level system")
The commands are identical to the magic syntax but passed as plain strings. This is the same interface that NotebookScriptWriter relies on when emitting code for monitored_script.py.