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

Use _get_safe_job_name in JobGenerator #1173

Merged
merged 1 commit into from
Sep 12, 2023
Merged
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
8 changes: 6 additions & 2 deletions pyiron_base/jobs/master/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from collections import OrderedDict
from datetime import datetime
from typing import Union

import numpy as np
import pandas
Expand All @@ -19,6 +20,7 @@
from pyiron_base.jobs.job.extension.jobstatus import JobStatus
from pyiron_base.state import state
from pyiron_base.jobs.job.wrapper import job_wrapper_function
from pyiron_base.jobs.job.util import _get_safe_job_name
from pyiron_base.utils.deprecate import deprecate

__author__ = "Joerg Neugebauer, Jan Janssen"
Expand Down Expand Up @@ -825,7 +827,7 @@ def modify_job(job, parameter):
"""
raise NotImplementedError("Implement in derived class")

def job_name(self, parameter):
def job_name(self, parameter) -> Union[str, tuple]:
"""
Return new job name from parameter object. The next child job created
will have this name. Subclasses may override this to give custom job
Expand All @@ -837,6 +839,8 @@ def job_name(self, parameter):

Returns:
str: job name for the next child job
tuple: construct the job name via :func:`_get_safe_job_name`;
allows any object that can be coerced to str inside the tuple
"""
return self._master.ref_job.job_name + "_" + str(self._childcounter)

Expand All @@ -859,7 +863,7 @@ def next(self):
if len(self.parameter_list_cached) > self._childcounter:
current_paramenter = self.parameter_list_cached[self._childcounter]
job = self._master.create_child_job(
self.job_name(parameter=current_paramenter)
_get_safe_job_name(self.job_name(parameter=current_paramenter))
)
if job is not None:
self._childcounter += 1
Expand Down