Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename decorator from @pyiron_job to @job #1686

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiron_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pyiron_base.jobs.master.interactivewrapper import InteractiveWrapper
from pyiron_base.jobs.master.list import ListMaster
from pyiron_base.jobs.master.parallel import JobGenerator, ParallelMaster
from pyiron_base.project.decorator import pyiron_job
from pyiron_base.project.decorator import job
from pyiron_base.project.external import Notebook, dump, load
from pyiron_base.project.generic import Creator, Project
from pyiron_base.state import state
Expand Down
8 changes: 4 additions & 4 deletions pyiron_base/project/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# The combined decorator
def pyiron_job(
def job(
funct: Optional[callable] = None,
*,
host: Optional[str] = None,
Expand Down Expand Up @@ -52,13 +52,13 @@ def pyiron_job(
callable: The decorated functions

Example:
>>> from pyiron_base import pyiron_job, Project
>>> from pyiron_base import job, Project
>>>
>>> @pyiron_job
>>> @job
>>> def my_function_a(a, b=8):
>>> return a + b
>>>
>>> @pyiron_job(cores=2)
>>> @job(cores=2)
>>> def my_function_b(a, b=8):
>>> return a + b
>>>
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/flex/test_decorator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pyiron_base._tests import TestWithProject
from pyiron_base import pyiron_job
from pyiron_base import job
import unittest


Expand All @@ -8,11 +8,11 @@ def tearDown(self):
self.project.remove_jobs(recursive=True, silently=True)

def test_delayed(self):
@pyiron_job()
@job()
def my_function_a(a, b=8):
return a + b

@pyiron_job(cores=2)
@job(cores=2)
def my_function_b(a, b=8):
return a + b

Expand All @@ -24,11 +24,11 @@ def my_function_b(a, b=8):
self.assertEqual(len(edges_lst), 6)

def test_delayed_simple(self):
@pyiron_job
@job
def my_function_a(a, b=8):
return a + b

@pyiron_job
@job
def my_function_b(a, b=8):
return a + b

Expand Down
8 changes: 4 additions & 4 deletions tests/usecases/ADIS/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"from ase.build import bulk\n",
"from ase.io import write\n",
"from adis_tools.parsers import parse_pw\n",
"from pyiron_base import pyiron_job, Project"
"from pyiron_base import job, Project"
]
},
{
Expand Down Expand Up @@ -75,7 +75,7 @@
},
"outputs": [],
"source": [
"@pyiron_job(output_key_lst=[\"energy\", \"volume\", \"structure\"])\n",
"@job(output_key_lst=[\"energy\", \"volume\", \"structure\"])\n",
"def calculate_qe(working_directory, input_dict):\n",
" write_input(\n",
" input_dict=input_dict,\n",
Expand All @@ -102,7 +102,7 @@
},
"outputs": [],
"source": [
"@pyiron_job\n",
"@job\n",
"def generate_structures(structure, strain_lst):\n",
" structure_lst = []\n",
" for strain in strain_lst:\n",
Expand All @@ -122,7 +122,7 @@
},
"outputs": [],
"source": [
"@pyiron_job\n",
"@job\n",
"def plot_energy_volume_curve(volume_lst, energy_lst):\n",
" plt.plot(volume_lst, energy_lst)\n",
" plt.xlabel(\"Volume\")\n",
Expand Down
Loading