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

Merge main #1623

Merged
merged 29 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
702e292
Fix project mv
jan-janssen Aug 22, 2024
0f5293d
Merge pull request #1615 from pyiron/project_mv
jan-janssen Aug 22, 2024
509ebae
Fix windows paths
jan-janssen Aug 22, 2024
9299ea4
Merge pull request #1616 from pyiron/fix_archive
jan-janssen Aug 22, 2024
8bfaf29
add old tar files
samwaseda Aug 23, 2024
9fb5a05
save current state
samwaseda Aug 23, 2024
9dd4157
stash changes to see whether the tests still fail
samwaseda Aug 23, 2024
fa80cd4
restore changes
samwaseda Aug 23, 2024
69820de
separate class
samwaseda Aug 23, 2024
5b5223a
add loading
samwaseda Aug 23, 2024
16b4e18
change order
samwaseda Aug 23, 2024
e9abb0b
Get executable keys from dataclass fields
jan-janssen Aug 23, 2024
6416c3a
Merge remote-tracking branch 'origin/server' into add_pack_bc_tests
samwaseda Aug 23, 2024
0c0c1eb
also check inputs
samwaseda Aug 23, 2024
6dad8c3
Merge pull request #1619 from pyiron/clean_up_executable
jan-janssen Aug 23, 2024
f6587f5
align things that I didn't change
samwaseda Aug 23, 2024
d72487f
Merge remote-tracking branch 'origin' into add_pack_bc_tests
samwaseda Aug 23, 2024
ee13e20
Merge remote-tracking branch 'origin' into server
samwaseda Aug 23, 2024
b5c3f6d
Merge remote-tracking branch 'origin/server' into add_pack_bc_tests
samwaseda Aug 23, 2024
7d37581
Make a backward change made by Jan temporarily, to see whether the Wi…
samwaseda Aug 23, 2024
5989c18
I don't understand this one change
samwaseda Aug 23, 2024
672d26e
add output check
samwaseda Aug 23, 2024
29fa89c
replace . by os.getcwd
samwaseda Aug 23, 2024
103302e
Revert "Make a backward change made by Jan temporarily, to see whethe…
samwaseda Aug 23, 2024
4394b7b
Merge pull request #1611 from pyiron/server
pmrv Aug 23, 2024
7ad654a
Merge pull request #1617 from pyiron/add_pack_bc_tests
pmrv Aug 23, 2024
dbd263a
Bump executorlib from 0.0.1 to 0.0.2
dependabot[bot] Aug 26, 2024
697ebd2
[dependabot skip] Update environment
github-actions[bot] Aug 26, 2024
2ca2d67
Merge pull request #1622 from pyiron/dependabot/pip/executorlib-0.0.2
jan-janssen Aug 26, 2024
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 .ci_support/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- psutil =6.0.0
- pyfileindex =0.0.27
- pyiron_snippets =0.1.4
- executorlib =0.0.1
- executorlib =0.0.2
- pysqa =0.1.21
- pytables =3.10.1
- sqlalchemy =2.0.32
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/environment-mini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- psutil =6.0.0
- pyfileindex =0.0.27
- pyiron_snippets =0.1.3
- executorlib =0.0.1
- executorlib =0.0.2
- pysqa =0.1.21
- pytables =3.10.1
- sqlalchemy =2.0.32
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- psutil =6.0.0
- pyfileindex =0.0.27
- pyiron_snippets =0.1.4
- executorlib =0.0.1
- executorlib =0.0.2
- pysqa =0.1.21
- pytables =3.10.1
- sqlalchemy =2.0.32
Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- psutil =6.0.0
- pyfileindex =0.0.27
- pyiron_snippets =0.1.4
- executorlib =0.0.1
- executorlib =0.0.2
- pysqa =0.1.21
- pytables =3.10.1
- sqlalchemy =2.0.32
Expand Down
11 changes: 2 additions & 9 deletions pyiron_base/jobs/job/extension/executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the terms of "New BSD License", see the LICENSE file.

import os
from dataclasses import asdict
from dataclasses import asdict, fields

from pyiron_snippets.resources import ExecutableResolver

Expand Down Expand Up @@ -218,14 +218,7 @@ def _to_dict(self):
return asdict(self.storage)

def _from_dict(self, obj_dict, version=None):
data_container_keys = [
"version",
"name",
"operation_system_nt",
"executable",
"mpi",
"accepted_return_codes",
]
data_container_keys = tuple(f.name for f in fields(ExecutableDataClass))
executable_class_dict = {}
# Backwards compatibility; dict state used to be nested one level deeper
if "executable" in obj_dict.keys() and isinstance(obj_dict["executable"], dict):
Expand Down
4 changes: 2 additions & 2 deletions pyiron_base/jobs/job/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ def _get_project_for_copy(job, project, new_job_name):
):
file_project = project.project
hdf5_project = project.project_hdf5.open(new_job_name)
elif isinstance(project, job.project.__class__):
elif isinstance(job.project, project.__class__):
file_project = project
hdf5_project = job.project_hdf5.__class__(
project=project, file_name=new_job_name, h5_path="/" + new_job_name
)
elif isinstance(project, job.project_hdf5.__class__):
elif isinstance(job.project_hdf5, project.__class__):
file_project = project.project
hdf5_project = project.open(new_job_name)
elif project is None:
Expand Down
9 changes: 5 additions & 4 deletions pyiron_base/project/archiving/import_archive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import posixpath
import tarfile
import tempfile
from shutil import copytree
Expand Down Expand Up @@ -57,8 +58,8 @@ def import_jobs(project_instance, archive_directory):

pr_import = project_instance.open(os.curdir)
df["project"] = [
os.path.normpath(
os.path.join(pr_import.project_path, os.path.relpath(p, common_path))
posixpath.normpath(
posixpath.join(pr_import.project_path, posixpath.relpath(p, common_path))
)
+ "/"
for p in df["project"].values
Expand Down Expand Up @@ -105,8 +106,8 @@ def transfer_files(origin_path: str, project_path: str):
str: Common path.
"""
df = get_dataframe(origin_path=origin_path)
common_path = os.path.commonpath(list(df["project"]))
copytree(os.path.join(origin_path, common_path), project_path, dirs_exist_ok=True)
common_path = posixpath.commonpath(list(df["project"]))
copytree(posixpath.join(origin_path, common_path), project_path, dirs_exist_ok=True)
return df, common_path


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
]
dependencies = [
"cloudpickle==3.0.0",
"executorlib==0.0.1",
"executorlib==0.0.2",
"h5io_browser==0.1.0",
"h5py==3.11.0",
"numpy==2.1.0",
Expand Down
2 changes: 2 additions & 0 deletions tests/static/pack/export.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
,id,status,chemicalformula,job,subjob,project,timestart,timestop,totalcputime,computer,hamilton,hamversion,parentid,masterid
0,0,finished,,toy,/toy,test_pack/my_project,2024-08-22 16:10:26.556984,,,pyiron@7720454e9ac5#1,ToyJob,0.4,,
Binary file added tests/static/pack/test_pack.tar.gz
Binary file not shown.
23 changes: 22 additions & 1 deletion tests/unit/archiving/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pyiron_base import Project
from pandas._testing import assert_frame_equal
from filecmp import dircmp
from shutil import rmtree
from shutil import rmtree, copytree
import tarfile
from pyiron_base._tests import PyironTestCase, ToyJob

Expand Down Expand Up @@ -181,5 +181,26 @@ def test_backwards_compatibility(self):
self.imp_pr.unpack(origin_path=self.arch_dir_comp, csv_file_name="ahoy.csv")


class TestUnpackingBackwardsCompatibility(PyironTestCase):
def test_import_old_tar(self):
copytree(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../../static/pack",
),
os.getcwd(),
dirs_exist_ok=True,
)
pr = Project("old_tar")
pr.unpack(origin_path="test_pack.tar.gz")
job = pr.load("toy")
self.assertEqual(job.job_name, "toy")
self.assertEqual(job.input.data_in, 100)
self.assertEqual(job.output.data_out, 101)
pr.remove(enable=True, enforce=True)
os.remove("test_pack.tar.gz")
os.remove("export.csv")


if __name__ == "__main__":
unittest.main()
Loading