{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pyiron_base import PythonTemplateJob" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "class ToyJob(PythonTemplateJob):\n", " def __init__(self, project, job_name):\n", " super(ToyJob, self).__init__(project, job_name) \n", " self.input['input_energy'] = 100\n", " \n", " # This function is executed \n", " def run_static(self):\n", " with self.project_hdf5.open(\"output/generic\") as h5out: \n", " h5out[\"energy_tot\"] = self.input[\"input_energy\"]\n", " self.status.finished = True" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Parameter Value Comment\n", "0 input_energy 100 \n", "The job toy was saved and received the ID: 470\n" ] }, { "data": { "text/plain": [ "100" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from pyiron_base import Project\n", "pr = Project('test')\n", "pr.remove_jobs_silently(recursive=True)\n", "job = pr.create_job(job_type=ToyJob, job_name=\"toy\")\n", "print(job.input)\n", "job.run()\n", "job['output/generic/energy_tot']" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "pr.pack(destination_path='archive_folder',compress=True)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idstatuschemicalformulajobsubjobprojectpathprojecttimestarttimestoptotalcputimecomputerhamiltonhamversionparentidmasterid
0470finishedNonetoy/toy/home/muhammad/workspace/gitRepo/pyiron_base/notebooks/test/2021-01-11 11:53:56.199496NoneNonepyiron@cmleo14#1GenericJob0.4NoneNone
\n", "
" ], "text/plain": [ " id status chemicalformula job subjob projectpath \\\n", "0 470 finished None toy /toy /home/muhammad/ \n", "\n", " project timestart \\\n", "0 workspace/gitRepo/pyiron_base/notebooks/test/ 2021-01-11 11:53:56.199496 \n", "\n", " timestop totalcputime computer hamilton hamversion parentid \\\n", "0 None None pyiron@cmleo14#1 GenericJob 0.4 None \n", "\n", " masterid \n", "0 None " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pr.job_table()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.1" } }, "nbformat": 4, "nbformat_minor": 4 }