Skip to content

Commit

Permalink
Update template job to use ~~DataContainer~~ HasStorage (#428)
Browse files Browse the repository at this point in the history
* Update template job to use DataContainer

* Update pyiron_base/job/template.py

Co-authored-by: Marvin Poul <[email protected]>

* Update pyiron_base/job/template.py

Co-authored-by: Marvin Poul <[email protected]>

* Just straight up use HasStorage

Co-authored-by: Marvin Poul <[email protected]>
  • Loading branch information
liamhuber and pmrv authored Sep 14, 2021
1 parent 4acb6c9 commit 5bbdd53
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions pyiron_base/job/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

from pyiron_base.job.generic import GenericJob
from pyiron_base.generic.parameters import GenericParameters
from pyiron_base.generic.object import HasStorage

__author__ = "Jan Janssen"
__copyright__ = (
Expand All @@ -20,26 +20,20 @@
__date__ = "May 15, 2020"


class TemplateJob(GenericJob):
class TemplateJob(GenericJob, HasStorage):
def __init__(self, project, job_name):
super().__init__(project, job_name)
self.input = GenericParameters(table_name="input")

def to_hdf(self, hdf=None, group_name=None):
super().to_hdf(
hdf=hdf,
group_name=group_name
)
with self.project_hdf5.open("input") as h5in:
self.input.to_hdf(h5in)

def from_hdf(self, hdf=None, group_name=None):
super().from_hdf(
hdf=hdf,
group_name=group_name
)
with self.project_hdf5.open("input") as h5in:
self.input.from_hdf(h5in)
GenericJob.__init__(self, project, job_name)
HasStorage.__init__(self)
self._storage.create_group('input')
self._storage.create_group('output')

@property
def input(self):
return self._storage.input

@property
def output(self):
return self._storage.output


class PythonTemplateJob(TemplateJob):
Expand Down

0 comments on commit 5bbdd53

Please sign in to comment.