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

add wrap_executable() function to project #1312

Merged
merged 9 commits into from
Mar 11, 2024
Merged

add wrap_executable() function to project #1312

merged 9 commits into from
Mar 11, 2024

Conversation

jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Feb 4, 2024

This pull request introduces the wrap_executable() function to the project class in analogy to the wrap_python_function():

def write_input(input_dict, working_directory="."):
    with open(os.path.join(working_directory, "input_file"), "w") as f:
        f.write(str(input_dict["energy"]))


def collect_output(working_directory="."):
    with open(os.path.join(working_directory, "output_file"), "r") as f:
        return {"energy": float(f.readline())}


from pyiron_base import Project
pr = Project("test")
job = pr.wrap_executable(
    job_name="Cat_Job_energy_1_0",
    write_input_funct=write_input,
    collect_output_funct=collect_output,
    input_dict={"energy": 1.0},
    executable_str="cat input_file > output_file",
    execute_job=True,
)
print(job.output)

@jan-janssen jan-janssen marked this pull request as draft February 4, 2024 10:13
@jan-janssen
Copy link
Member Author

@samwaseda
Copy link
Member

Where is the actual run defined?

@samwaseda
Copy link
Member

Sorry I meant conda run

@jan-janssen
Copy link
Member Author

Where is the actual run defined?

This was handled in a separate pull request #1315

@jan-janssen jan-janssen changed the title create_job_step() function add wrap_executable() function to project Mar 10, 2024
@jan-janssen jan-janssen marked this pull request as ready for review March 10, 2024 19:59
@jan-janssen
Copy link
Member Author

The pull request is ready for review again.

tests/flex/test_wrap_executable.py Show resolved Hide resolved
@jan-janssen jan-janssen merged commit 8d989cf into main Mar 11, 2024
24 of 25 checks passed
@jan-janssen jan-janssen deleted the job_step branch March 11, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants