{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true, "pycharm": { "name": "#%% md\n" } }, "source": [ "## Using client tools in Jupyter notebook\n", "\n", "You can use panda-client tools (pathena, prun, phpo, and pbook) in Jupyter notebook through the\n", "magic command interface, _**%command args**_.\n", "\n", "First, you need to setup Jupyter interface as usual." ] }, { "cell_type": "code", "execution_count": null, "outputs": [], "source": [ "from pandaclient import panda_jupyter\n", "panda_jupyter.setup()" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } } }, { "cell_type": "markdown", "source": [ "Then, for example" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } } }, { "cell_type": "code", "execution_count": null, "outputs": [], "source": [ "%prun -h" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } } }, { "cell_type": "markdown", "source": [ "gives\n", "```\n", "usage: prun [options]\n", "\n", " HowTo is available at https://twiki.cern.ch/twiki/bin/view/PanDA/PandaRun\n", "\n", "optional arguments:\n", " -h, --help show this help message and exit\n", " --helpGroup {PRINT,PRUN,CONFIG,INPUT,OUTPUT,JOB,BUILD,SUBMIT,EVTFILTER,EXPERT,CONTAINERJOB,ALL}\n", " Print individual group help (the group name is not\n", " case-sensitive), where \"ALL\" will print all groups\n", " together. Some options such as --inOutDsJson may SPAN\n", " several groups\n", "\n", "Examples:\n", " prun --exec \"echo %IN > input.txt; root.exe; root -b -q macrotest.C\" --athenaTag=22.0.0 --inDS ...\n", " prun --exec \"cpptest %IN\" --bexec \"make\" --athenaTag=22.0.0 --inDS ...\n", " prun --loadJson prunConfig.json # read all prun options from one json file\n", "```\n", "and" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } } }, { "cell_type": "code", "source": [ "%prun -3 --exec ls --outDS user.hoge.`uuidgen` --vo sphenix" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "gives\n", "```\n", "INFO : gathering files under /Users/hoge/jupyter/home/panda\n", "INFO : upload source files\n", "INFO : submit user.hoge.73818405-09D2-4BA0-8186-E3EB22BC9AFD/\n", "INFO : succeeded. new jediTaskID=473\n", "```\n", "respectively.\n", "\n", "
\n", "\n", "Note that it wold also be possible to call those tools as shell commands _**!command args**_,\n", "but they will be hang up\n", "if you need to enter information, such as passphrase, on the console.\n", "Especially this is the case for pbook, so you need to use %pbook instead of !pbook." ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } } }, { "cell_type": "code", "execution_count": null, "outputs": [], "source": [ "%pbook" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } } }, { "cell_type": "markdown", "source": [ "Then you go into the interactive session and can use pbook commands on the command prompt.\n", "```\n", "PBook user: hoge\n", "\n", "Start pBook 1.4.47\n", "\n", ">>> show()\n", "Showing only max 1000 tasks in last 14 days. One can set days=N to see tasks in last N days, and limit=M to see at most M latest tasks\n", "JediTaskID Status Fin% TaskName\n", "________________________________________________________________\n", " 23084322 done 100.0% user.hoge.61cdfaf1-5cea-4a94-8f38-f8f2eb035303/\n", " 23083910 done 100.0% user.hoge.f2b8736f-6471-4fe2-a0a0-13b67ee63ac0/\n", " 23083909 done 100.0% user.hoge.5db466a4-f04f-4a7a-94ba-80722f7f9639/\n", " 23012863 done 100.0% user.hoge.aeab8f8b-271a-4c63-9763-695d77d09b61/\n", " 23012862 done 100.0% user.hoge.f2ddc8cf-9892-410c-9d6d-5db577e84ebc/\n", "\n", ">>> kill(475)\n", "Kill command registered: reqID=475 will be killed soon.\n", "[True]\n", "\n", ">>>\n", "```\n", "\n", "---\n", "\n", "Download [notebook](https://raw.githubusercontent.com/PanDAWMS/panda-docs/main/docs/source/client/notebooks/magic.ipynb)\n" ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }