{"id":24269065,"url":"https://github.com/ow2-proactive/proactive-jupyter-kernel","last_synced_at":"2025-09-24T07:32:10.131Z","repository":{"id":37818841,"uuid":"179084991","full_name":"ow2-proactive/proactive-jupyter-kernel","owner":"ow2-proactive","description":"Proactive Kernel for JupyterLab","archived":false,"fork":false,"pushed_at":"2024-12-05T17:30:13.000Z","size":1686,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-01-14T12:24:23.243Z","etag":null,"topics":["activeeon","jupyter","jupyter-kernels","jupyter-lab","jupyter-notebook","proactive","python"],"latest_commit_sha":null,"homepage":"https://www.activeeon.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ow2-proactive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-02T13:34:13.000Z","updated_at":"2024-08-23T14:25:52.000Z","dependencies_parsed_at":"2024-05-28T15:37:51.056Z","dependency_job_id":"9959f91e-5e4c-4f58-9fc3-49f4016c937c","html_url":"https://github.com/ow2-proactive/proactive-jupyter-kernel","commit_stats":{"total_commits":137,"total_committers":7,"mean_commits":"19.571428571428573","dds":0.5328467153284672,"last_synced_commit":"8c06d684468e8265bd9c32e0fb37015bb172fd8f"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fproactive-jupyter-kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fproactive-jupyter-kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fproactive-jupyter-kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ow2-proactive%2Fproactive-jupyter-kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ow2-proactive","download_url":"https://codeload.github.com/ow2-proactive/proactive-jupyter-kernel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234055053,"owners_count":18772438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activeeon","jupyter","jupyter-kernels","jupyter-lab","jupyter-notebook","proactive","python"],"created_at":"2025-01-15T14:39:51.363Z","updated_at":"2025-09-24T07:32:09.689Z","avatar_url":"https://github.com/ow2-proactive.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![License BSD](https://img.shields.io/badge/License-BSD-blue.svg \"License BSD\")\n![Python 3](https://img.shields.io/badge/Python-3-brightgreen.svg \"Python 3\")\n![blabla](https://img.shields.io/pypi/v/proactive-jupyter-kernel.svg \"bla\")\n\n# proactive-jupyter-kernel\nThe ActiveEon Jupyter Kernel adds a kernel backend to Jupyter. This kernel interfaces directly with the ProActive\nscheduler and constructs tasks and workflows to execute them on the fly.\n\nWith this interface, users can run their code locally and test it using a native python kernel, and by a simple switch to\nProActive kernel, run it on remote public or private infrastructures without having to modify the code. See the example below:\n\n![Image not found](./images/direct_execution_from_jupyter.png \"Direct execution from Jupyter with ActiveEon Kernel\")\n\n## 1. Installation:\n\n### 1.1 Requirements:\n\nPython 2 or 3\n\n### 1.2 Using PyPi\n\n* open a terminal\n\n* install the ProActive jupyter kernel with the following commands:\n\n```bash\n$ pip install proactive proactive-jupyter-kernel --upgrade\n$ python -m proactive-jupyter-kernel.install\n```\n\n### 1.3 Using source code\n\n* open a terminal\n\n* clone the repository on your local machine:\n\n```bash\n$ git clone git@github.com:ow2-proactive/proactive-jupyter-kernel.git\n```\n\n* install the ProActive jupyter kernel with the following commands:\n\n```bash\n$ pip install proactive-jupyter-kernel/\n$ python -m proactive-jupyter-kernel.install\n```\n\n## 2. Platform\n\nYou can use any jupyter platform.\nWe recommend to use [jupyter lab](https://jupyterlab.readthedocs.io/en/stable/). To launch it from your terminal after\nhaving installed it:\n\n```bash\n$ jupyter lab\n```\nor in daemon mode:\n```bash\n$ nohup jupyter lab \u0026\u003e/dev/null \u0026\n```\n\nWhen opened, click on the ProActive icon to open a notebook based on the ProActive kernel.\n\n## 3. Help\n\nAs a quick start, we recommend the user to run the `#%help()` pragma using the following script:\n\n```python\n#%help()\n```\n\nThis script gives a brief description of all the different pragmas that the ProActive Kernel provides.\n\nTo get a more detailed description of a needed pragma, the user can run the following script:\n\n```python\n#%help(pragma=PRAGMA_NAME)\n```\n\n## 4. Connection\n\n### 4.1 Using connect()\n\nIf you are trying ProActive for the first time, sign up on the [try platform](https://try.activeeon.com/signup.html).\nOnce you receive your login and password, connect to the trial platform using the `#%connect()` pragma:\n\n```python\n#%connect(login=YOUR_LOGIN, password=YOUR_PASSWORD)\n```\n\nTo connect to another ProActive server host, use the later pragma this way:\n\n```python\n#%connect(host=YOUR_HOST, [port=YOUR_PORT], login=YOUR_LOGIN, password=YOUR_PASSWORD)\n```\n\nNotice that the `port` parameter is optional. The default connexion port is `8080`.\n\nYou can also connect to a distant server by providing its `url` in the following way:\n\n```python\n#%connect(url=YOUR_SERVER_URL, login=YOUR_LOGIN, password=YOUR_PASSWORD)\n```\n\nBy providing the complete `url` of the server, users can eventually connect through the secure HTTPS protocol.\n\n### 4.2 Using a configuration file:\n\nFor automatic sign in, create a file named *proactive_config.ini* in your notebook working directory.\n\nFill your configuration file according to one of the following two formats:\n\n- By providing the server `host` and `port`:\n\n```ini\n[proactive_server]\nhost=YOUR_HOST\nport=YOUR_PORT\n[user]\nlogin=YOUR_LOGIN\npassword=YOUR_PASSWORD\n```\n\n- By providing the server `url`:\n\n```ini\n[proactive_server]\nurl=YOUR_SERVER_URL\n[user]\nlogin=YOUR_LOGIN\npassword=YOUR_PASSWORD\n```\n\nSave your changes and restart the ProActive kernel.\n\nYou can also force the current kernel to connect using any _.ini_ config file through the `#%connect()` pragma:\n\n```python\n#%connect(path=PATH_TO/YOUR_CONFIG_FILE.ini)\n```\n\n(For more information about this format please check\n[configParser](https://docs.python.org/3/library/configparser.html))\n\n## 5. Usage\n\n#### 5.1 Creating a Python task\n\nTo create a new task, use the pragma `#%task()` followed by the task implementation script written into a notebook\nblock code.\nTo use this pragma, a task name has to be provided at least. Example:\n\n```python\n#%task(name=myTask)\nprint('Hello world')\n```\n\nGeneral usage:\n\n```python\n#%task(name=TASK_NAME, [language=SCRIPT_LANGUAGE], [dep=[TASK_NAME1,TASK_NAME2,...]], [generic_info=[(KEY1,VAL1), (KEY2,VALUE2),...]], [variables=[(VAR1,VAL1), (VAR2,VALUE2),...]], [export=[VAR_NAME1,VAR_NAME2,...]], [import=[VAR_NAME1,VAR_NAME2,...]], [path=IMPLEMENTATION_FILE_PATH])\\n'\n```\n\nUsers can also provide more information about the task using the pragma's options. In the following, we give more\ndetails about the possible options:\n\n##### 5.1.1 Language\n\nThe `language` parameter is needed when the task script is not written in native Python. If not provided, Python will be\n selected as the default language.\nThe supported programming languages are:\n\n* Linux_Bash\n* Windows_Cmd\n* DockerCompose\n* Scalaw\n* Groovy\n* Javascript\n* Jython\n* Python\n* Ruby\n* Perl\n* PowerShell\n* R\n\nHere is an example that shows a task implementation written in `Linux_Bash`:\n\n```bash\n#%task(name=myTask, language=Linux_Bash)\necho 'Hello, World!'\n```\n\n##### 5.1.2 Dependencies\n\nOne of the most important notions in workflows is the dependencies between tasks. To specify this information, use the\n`dep` parameter. Its value should be a list of all tasks on which the new task depends. Example:\n\n```python\n#%task(name=myTask,dep=[parentTask1,parentTask2])\nprint('Hello world')\n```\n\n##### 5.1.3 Variables\n\nTo specify [task variables](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_task_variables), \nyou should provide the `variables` parameter. Its value should be a list of tuples `(key,value)` that corresponds to \nthe names and adequate values of the corresponding task variables. Example:\n\n```python\n#%task(name=myTask, variables=[(var1,value1),(var2,value2)])\nprint('Hello world')\n```\n\n##### 5.1.4 Generic information\n\nTo specify the values of some advanced ProActive variables called\n[generic_information](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_generic_information), you should\nprovide the `generic_info` parameter. Its value should be a list of tuples `(key,value)` that corresponds to the names\nand adequate values of the Generic Information. Example:\n\n```python\n#%task(name=myTask, generic_info=[(var1,value1),(var2,value2)])\nprint('Hello world')\n```\n\n##### 5.1.5 Export/import variables\n\nThe `export` and `import` parameters ensure variables propagation between the different tasks of a workflow.\nIf `myTask1` variables `var1` and `var2` are needed in `myTask2`, both pragmas have to specify this information as\nfollows:\n\n* `myTask1` should include an `export` parameter with a list of these variable names,\n* `myTask2` should include an `import` parameter with a list including the same names.\n\nExample:\n\n`myTask1` implementation block would be:\n```python\n#%task(name=myTask1, export=[var1,var2])\nvar1 = \"Hello\"\nvar2 = \"ActiveEon!\"\n```\n\nand `myTask2` implementation block would be:\n```python\n#%task(name=myTask2, dep=[myTask1], import[var1,var2])\nprint(var1 + \" from \" + var2)\n```\n\n##### 5.1.6 Implementation file\n\nIt is also possible to use an external implementation file to define the task implementation. To do so, the option `path`\n should be used.\n\nExample:\n\n```python\n#%task(name=myTask,path=PATH_TO/IMPLEMENTATION_FILE.py)\n```\n\n#### 5.2 Importing libraries\n\nThe main difference between the ProActive and 'native language' kernels resides in the way the memory is accessed\nduring blocks execution. In a common native language kernel, the whole script code (all the notebook blocks) is\nlocally executed in the same shared memory space; whereas the ProActive kernel will execute each created task in an\nindependent process. In order to facilitate the transition from native language to ProActive kernels, we included the\npragma `#%import()`. This pragma gives the user the ability to add libraries that are common to all created tasks, and\nthus relative distributed processes, that are implemented in the same native script language.\n\nThe import pragma is used as follows:\n\n`#%import([language=SCRIPT_LANGUAGE])`.\n\nExample:\n\n```python\n#%import(language=Python)\nimport os\nimport pandas\n```\n\nNOTE: If the language is not specified, Python is considered as default language.\n\n#### 5.3 Adding a fork environment\n\nTo configure a fork environment for a task, use the `#%fork_env()` pragma. To do so, you have to provide the name of the\ncorresponding task and the fork environment implementation.\n\nExample:\n\n```python\n#%fork_env(name=TASK_NAME)\ncontainerName = 'activeeon/dlm3'\ndockerRunCommand =  'docker run '\ndockerParameters = '--rm '\npaHomeHost = variables.get(\"PA_SCHEDULER_HOME\")\npaHomeContainer = variables.get(\"PA_SCHEDULER_HOME\")\nproActiveHomeVolume = '-v '+paHomeHost +':'+paHomeContainer+' '\nworkspaceHost = localspace\nworkspaceContainer = localspace\nworkspaceVolume = '-v '+localspace +':'+localspace+' '\ncontainerWorkingDirectory = '-w '+workspaceContainer+' '\npreJavaHomeCmd = dockerRunCommand + dockerParameters + proActiveHomeVolume + workspaceVolume + containerWorkingDirectory + containerName\n```\n\nOr, you can provide the task name and the path of a _.py_ file containing the fork environment code:\n\n```python\n#%fork_env(name=TASK_NAME, path=PATH_TO/FORK_ENV_FILE.py)\n```\n\n#### 5.4 Adding a selection script\n\nTo add a selection script to a task, use the `#%selection_script()` pragma. To do so, you have to provide the name of\nthe corresponding task and the selection code implementation.\n\nExample:\n\n```python\n#%selection_script(name=TASK_NAME)\nselected = True\n```\n\nOr, you can provide the task name and the path of a _.py_ file containing the selection code:\n\n```python\n#%selection_script(name=TASK_NAME, path=PATH_TO/SELECTION_CODE_FILE.py)\n```\n\n#### 5.5 Adding job fork environment and/or selection script\n\nIf the selection scripts and/or the fork environments are the same for all job tasks, we can add them just once using\nthe `job_selection_script` and/or the `job_fork_env` pragmas.\n\nUsage:\n\nFor a job selection script, please use:\n\n```python\n#%job_selection_script([language=SCRIPT_LANGUAGE], [path=./SELECTION_CODE_FILE.py], [force=on/off])\n```\n\nFor a job fork environment, use:\n\n```python\n#%job_fork_env([language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py], [force=on/off])\n```\n\nThe `force` parameter defines whether the pragma has to overwrite the task selection scripts or the fork environment\nalready set.\n\n#### 5.6 Adding pre and/or post scripts\n\nSometimes, specific scripts has to be executed before and/or after a particular task. To do that, the solution provides\n `pre_script` and `post_script` pragmas.\n\nTo add a pre-script to a task, please use:\n\n```python\n#%pre_script(name=TASK_NAME, language=SCRIPT_LANGUAGE, [path=./PRE_SCRIPT_FILE.py])\n```\n\nTo add a post-script to a task, use:\n\n```python\n#%post_script(name=TASK_NAME, language=SCRIPT_LANGUAGE, [path=./POST_SCRIPT_FILE.py])\n```\n\n#### 5.7 Branch control\n\nThe [branch](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_branch) control provides the ability to \nchoose between two alternative task flows, with the possibility to merge back to a common one.\n\nTo add a branch control to the current workflow, four specific tasks and one control condition should be added in \naccordance with the following order:\n\n1. a `branch` task,\n2. the related branching `condition` script,\n3. an `if` task that should be executed if the result of the `condition` task if `true`,\n4. an `else` task that should be executed if the result of the `condition` task if `false`,\n5. a `continuation` task that should be executed after the `if` or the `else` tasks.\n\nTo add a `branch` task, you can rely on the following macro:\n\n```python\n#%branch([name=TASK_NAME], [dep=[TASK_NAME1,TASK_NAME2,...]], [generic_info=[(KEY1,VAL1), (KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\nFor the branching `condition` script, use:\n\n```python\n#%condition()\n```\n\nFor an `if` task, please use:\n\n```python\n#%if([name=TASK_NAME], [generic_info=[(KEY1,VAL1),(KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\nFor an `else` task, use:\n\n```python\n#%else([name=TASK_NAME], [generic_info=[(KEY1,VAL1),(KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\nAnd finally, for the `continuation` task:\n\n```python\n#%continuation([name=TASK_NAME], [generic_info=[(KEY1,VAL1),(KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\n\n#### 5.8 Loop control\n\nThe [loop](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_loop) control provides the ability to repeat \na set of tasks.\n\nTo add a loop control to the current workflow, two specific tasks and one control condition should be added \nin the following order:\n\n1. a `start` task,\n2. the related looping `condition` script,\n3. a `loop` task.\n\nFor a `start` task, use:\n\n```python\n#%start([name=TASK_NAME], [dep=[TASK_NAME1,TASK_NAME2,...]], [generic_info=[(KEY1,VAL1), (KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\nFor the looping `condition` script, use:\n\n```python\n#%condition()\n```\n\nFor a `loop` task, please use:\n\n```python\n#%loop([name=TASK_NAME], [generic_info=[(KEY1,VAL1),(KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\n#### 5.9 Replicate control\n\nThe [replication](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_replicate) allows the execution of \nmultiple tasks in parallel when only one task is defined, and the number of tasks to run could change.\n\nThrough the ProActive Jupyter Kernel, users can add replicate controls in two main ways, a generic and a straight \nforward way.\n\n##### 5.9.1 Generic usage\n\nTo add a replicate control to the current workflow in the generic method, three specific tasks and one control runs \nscript should be added according to the following order:\n\n1. a `split` task,\n2. the related replication `runs` script,\n3. a `process` task,\n4. a `merge` task.\n\nFor a `split` task, use:\n\n```python\n#%split([name=TASK_NAME], [dep=[TASK_NAME1,TASK_NAME2,...]], [generic_info=[(KEY1,VAL1), (KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\nFor the replication `runs` script, use:\n\n```python\n#%runs()\n```\n\nFor a `process` task, please use:\n\n```python\n#%process([name=TASK_NAME], [generic_info=[(KEY1,VAL1),(KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\nAnd finally, for a `merge` task, use:\n\n```python\n#%merge([name=TASK_NAME], [generic_info=[(KEY1,VAL1),(KEY2,VALUE2),...]], [language=SCRIPT_LANGUAGE], [path=./FORK_ENV_FILE.py])\n```\n\n##### 5.9.2 Straight forward usage\n\nThe straight forward method to add a replication is most of all useful when the parallelism that should be \nimplemented is a task parallelism (the generic usage is more adapted to data parallelism).\n\nTo add a replication to a task, just add the runs control script by providing the `runs` option of the `task` pragma.\nExample:\n\n```python\n#%task(name=T2,dep=[T1],runs=3)\nprint(\"This output should be displayed 3 times ...\")\n```\n\nNOTE: To construct a valid workflow, straight forward replicated tasks must have one and only one parent task and one \nchild task at most. More information about replicate validation criteria are available \n[here](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_replicate).\n\n#### 5.10 Delete a task\n\nTo delete a task from the workflow, the user should run the pragma `#%delete_task()` in the following way:\n\n```python\n#%delete_task(name=TASK_NAME)\n```\n\n#### 5.11 Create a job\n\nTo create a job, specify job variables and/or job generic information, use the `#%job()` pragma:\n\n```python\n#%job(name=JOB_NAME, [generic_info=[(KEY1,VAL1), (KEY2,VALUE2),...]], [variables=[(VAR1,VAL1), (VAR2,VALUE2),...]])\n```\n\nNOTE: It is not necessary to create and assign a name explicitly to the job. If not done by the user, this step is\nimplicitly performed when the job is submitted (check section [Submit your job to the scheduler](#510-submit-your-job-to-the-scheduler) for more\ninformation).\n\n#### 5.12 Visualize job\n\nTo visualize the created workflow, use the `#%draw_job()` pragma to plot the workflow graph that represents the job\ninto a separate window:\n\n```python\n#%draw_job()\n```\n\nTwo optional parameters can be used to configure the way the kernel plots the workflow graph.\n\n**inline plotting:**\n\nIf this parameter is set to `off`, plotting the workflow graph is done through a [Matplotlib](https://matplotlib.org/) \nexternal window. The default value is `on`.\n\n```python\n#%draw_job(inline=off)\n```\n\n**save the workflow graph locally:**\n\nTo be sure that the workflow is saved into a _.png_ file, this option needs to be set to `on`. The default value is\n`off`.\n\n```python\n#%draw_job(save=on)\n```\n\nNote that the job's name can take one of the following possible values:\n\n1. The parameter `name` 's value, if provided\n2. The job's name, if created\n3. The notebook's name, if the kernel can retrieve it\n4. `Unnamed_job`, otherwise\n\nGeneral usage:\n\n```python\n#%draw_job([name=JOB_NAME], [inline=off], [save=on])\n```\n\n#### 5.13 Export the workflow in dot format\n\nTo export the created workflow into a [GraphViz](https://www.graphviz.org/) _.dot_ format, use the `#%write_dot()` pragma:\n\n```python\n#%write_dot(name=FILE_NAME)\n```\n\n#### 5.14 Import a workflow from a dot file\n\nTo create a workflow according to a [GraphViz](https://www.graphviz.org/) _.dot_ file, use the pragma `#%import_dot()`:\n\n```python\n#%import_dot(path=PATH_TO/FILE_NAME.dot)\n```\n\nBy default, the workflow will contain _Python_ tasks with empty implementation scripts. If you want to modify or add \nany information to a specific task, please use, as explained in [Creating a Task](#51-creating-a-python-task), the `#%task()` \npragma.\n\n#### 5.15 Submit your job to the scheduler\n\nTo submit the job to the ProActive Scheduler, the user has to use the `#%submit_job()` pragma:\n\n```python\n#%submit_job()\n```\n\nIf the job is not created, or is not up-to-date, the `#%submit_job()` creates a new job named as the old one.\nTo provide a new name, use the same pragma and provide a name as parameter:\n\n```python\n#%submit_job([name=JOB_NAME])\n```\n\nIf the job's name is not set, the ProActive kernel uses the current notebook name, if possible, or gives a random one.\n\n#### 5.16 List all submitted jobs\n\nTo get all submitted job IDs and names, use `list_submitted_jobs` pragma this way:\n\n```python\n#%list_submitted_jobs()\n```\n\n#### 5.17 Export the workflow in XML format\n\nTo export the created workflow in _.xml_ format, use the `#%export_xml()` pragma:\n\n```python\n#%export_xml([name=FILENAME])\n```\n\nNotice that the _.xml_ file will be saved under one of the following names:\n\n1. The parameter `name` 's value, if provided\n2. The job's name, if created\n3. The notebook's name, if the kernel can retrieve it\n4. `Unnamed_job`, otherwise\n\n#### 5.18 Get results\n\nAfter the execution of a ProActive workflow, two outputs can be obtained,\n* results: values that have been saved in the \n[task result variable](https://doc.activeeon.com/latest/user/ProActiveUserGuide.html#_task_result),\n* console outputs: classic outputs that have been displayed/printed \n\nTo get task results, please use the `#%get_task_result()` pragma by providing the task name, and either the job ID or\nthe job name:\n\n```python\n#%get_task_result([job_id=JOB_ID], [job_name=JOB_NAME], task_name=TASK_NAME)\n```\n\nThe result(s) of all the tasks of a job can be obtained with the `#%get_job_result()` pragma, by providing the job name\nor the job ID:\n\n```python\n#%get_job_result([job_id=JOB_ID], [job_name=JOB_NAME])\n```\n\nTo get and display console outputs of a task, you can use the `#%print_task_output()` pragma in the following\nway:\n\n```python\n#%print_task_output([job_id=JOB_ID], [job_name=JOB_NAME], task_name=TASK_NAME)\n```\n\nFinally, the  `#%print_job_output()` pragma allows to print all job outputs, by providing the job name or the job ID:\n\n```python\n#%print_job_output([job_id=JOB_ID], [job_name=JOB_NAME])\n```\n\nNOTE: If neither `job_name` nor the `job_id` are provided, the last submitted job is selected by default. \n\n### 6. Display and use ActiveEon Portals directly in Jupyter\n\nFinally, to have the hand on more parameters and features, the user should use ActiveEon Studio portals.\nThe main ones are the _Resource Manager_, the _Scheduling Portal_ and the _Workflow Automation_.\n\nThe example below shows how the user can directly monitor his submitted job's execution in the scheduling portal:\n\n![Image not found](./images/direct_submit_and_see_from_jupyter.png \"Directly in Jupyter: Submit, See your Job executing, Get Results\")\n\nTo show the resource manager portal related to the host you are connected to, just run:\n\n```python\n#%show_resource_manager([host=YOUR_HOST], [height=HEIGHT_VALUE], [width=WIDTH_VALUE])\n```\n\nFor the related scheduling portal:\n\n```python\n#%show_scheduling_portal([host=YOUR_HOST], [height=HEIGHT_VALUE], [width=WIDTH_VALUE])\n```\n\nAnd, for the related workflow execution:\n\n```python\n#%show_workflow_execution([host=YOUR_HOST], [height=HEIGHT_VALUE], [width=WIDTH_VALUE])\n```\n\nNOTE: The parameters `height` and `width` allow the user to adjust the size of the window inside the notebook.\n\n#### Current status\n\nFeatures:\n\n* *help*: prints all different pragmas/features of the kernel\n\n* *connect*: connects to an ActiveEon server (OPTION: connection using a configuration file)\n\n* *import*: import specified libraries to all tasks of a same script language\n\n* *task*: creates a task\n\n* *pre_script*: sets the pre-script of a task\n\n* *post_script*: sets the post-script of a task\n\n* *selection_script*: sets the selection script of a task\n\n* *job_selection_script*: sets the default selection script of a job\n\n* *fork_env*: sets the fork environment script\n\n* *job_fork_env*: sets the default fork environment of a job\n\n* *split*: creates/modifies a splitting task of a replicate control\n\n* *runs*: creates/modifies the configuration script of a replicate control\n\n* *process*: creates/modifies the script of a replicated processing task\n\n* *merge*: creates/modifies a merging task of a replicate control\n\n* *start*: creates/modifies a start task of a loop control\n\n* *loop*: creates/modifies a loop task of a loop control\n\n* *condition*: creates/modifies the condition script of a branch/loop control\n\n* *branch*: creates/modifies a branch task of a branching control\n\n* *if*: creates/modifies an if task of a branching control\n\n* *else*: creates/modifies an else task of a branching control\n\n* *continuation*: creates/modifies a continuation task of a branching control\n\n* *delete_task*: deletes a task from the workflow\n\n* *job*: creates/renames the job\n\n* *draw_job*: plot the workflow\n\n* *write_dot*: writes the workflow in .dot format\n\n* *import_dot*: imports the workflow from a .dot file\n\n* *submit_job*: submits the job to the scheduler\n\n* *get_result*: gets and prints the job results\n\n* *get_job_result*: gets and prints the job results\n\n* *get_task_result*: gets and prints the results of a given task\n\n* *print_job_output*: gets and prints the job outputs\n\n* *print_task_output*: gets and prints the outputs of a given task\n\n* *list_submitted_jobs*: gets and prints the ids and names of the submitted jobs\n\n* *export_xml*: exports the workflow in .xml format\n\n* *show_resource_manager*: opens the ActiveEon resource manager portal\n\n* *show_scheduling_portal*: opens the ActiveEon scheduling portal\n\n* *show_workflow_execution*: opens the ActiveEon workflow execution portal\n\n\n#### TODO\n\n###### Features improvements\n* execute in local a pragma free block\n* add options import_as_json/export_as_json\n* add draw(on/off), print_result(on/off) options in submit job pragma\n* multiple pragmas in a block handling\n* apply selection_script and fork_env to a list of names (tasks)\n* add auto-complete\n\n###### Documentation\n* add some examples pictures\n* add configure pragma section (block, multiblock)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fow2-proactive%2Fproactive-jupyter-kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fow2-proactive%2Fproactive-jupyter-kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fow2-proactive%2Fproactive-jupyter-kernel/lists"}