icmd-python 1.1.4__py3-none-any.whl → 1.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- icmd/version.py +1 -1
- {icmd_python-1.1.4.dist-info → icmd_python-1.1.5.dist-info}/METADATA +1 -1
- {icmd_python-1.1.4.dist-info → icmd_python-1.1.5.dist-info}/RECORD +5 -6
- icmd/clients/calphad_client.py +0 -93
- {icmd_python-1.1.4.dist-info → icmd_python-1.1.5.dist-info}/WHEEL +0 -0
- {icmd_python-1.1.4.dist-info → icmd_python-1.1.5.dist-info}/top_level.txt +0 -0
icmd/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.1.
|
|
1
|
+
__version__ = "1.1.5"
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
icmd/__init__.py,sha256=RKbCk0KLWswT4w2Ahfg15MGBhtOG70godi63UAQmjng,67
|
|
2
|
-
icmd/version.py,sha256=
|
|
2
|
+
icmd/version.py,sha256=KlgaVSJ1AQxCDJZgh4wFk-gpem-k9PfebW8U3hiKJD4,22
|
|
3
3
|
icmd/clients/__init__.py,sha256=cKiAGFDou9bwES19V6qwlMtG1rZVi963SoqCWzqQn2Y,32
|
|
4
|
-
icmd/clients/calphad_client.py,sha256=TTMOJilkIRHdTsSuyn3QMOcCCZ-H_W6ebKpBp9z6Kq8,3387
|
|
5
4
|
icmd/core/__init__.py,sha256=11bBl3MBG106aN3VhYi24CqNKMhE2eAjhvQ4cFVmXsc,102
|
|
6
5
|
icmd/core/base_client.py,sha256=1u-BJd3vzcG0MWAmhQbxwyzhpsPp7wj8pRfdJmW9R44,934
|
|
7
6
|
icmd/core/job_table_format.py,sha256=USo0eN40EnE9esfcscP0EWRK-6Zo8_8FIcjGRNvhruc,1473
|
|
8
7
|
icmd/core/session.py,sha256=mMWO5a8IzFn_bUcjpdetZaDtStAZLKzN6sqInHThuDw,13934
|
|
9
8
|
icmd/core/token_handler.py,sha256=mVMJSnQ2Y5smytykdxcBrgkMWpfP8nw0oIYdY23hGrc,1343
|
|
10
|
-
icmd_python-1.1.
|
|
11
|
-
icmd_python-1.1.
|
|
12
|
-
icmd_python-1.1.
|
|
13
|
-
icmd_python-1.1.
|
|
9
|
+
icmd_python-1.1.5.dist-info/METADATA,sha256=kK-AIq3V7GxR7n5IKeCEGSKQ6b65fb3Vrral-YP34fk,478
|
|
10
|
+
icmd_python-1.1.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
11
|
+
icmd_python-1.1.5.dist-info/top_level.txt,sha256=olzM6Z_QEwg7RrFVOnkgO0I2Ps2m7vhSqYQZYeiawcw,5
|
|
12
|
+
icmd_python-1.1.5.dist-info/RECORD,,
|
icmd/clients/calphad_client.py
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"""Client for the CALPHAD Simulation Toolkit."""
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from http import HTTPStatus
|
|
5
|
-
|
|
6
|
-
import pandas as pd
|
|
7
|
-
from pandas.io.formats.style import Styler
|
|
8
|
-
|
|
9
|
-
from icmd.core import BaseClient
|
|
10
|
-
from icmd.core.job_table_format import qt_job_table_style
|
|
11
|
-
|
|
12
|
-
try:
|
|
13
|
-
import qt_calphad
|
|
14
|
-
except ImportError:
|
|
15
|
-
qt_calphad = None
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class CalphadClient(BaseClient):
|
|
19
|
-
"""Client for the CALPHAD Simulation Toolkit."""
|
|
20
|
-
|
|
21
|
-
app_name = "simulation_calphad"
|
|
22
|
-
|
|
23
|
-
def __init__(self):
|
|
24
|
-
super().__init__()
|
|
25
|
-
|
|
26
|
-
if qt_calphad is None:
|
|
27
|
-
raise NotImplementedError("qt_calphad is not installed in current Python.")
|
|
28
|
-
|
|
29
|
-
def submit_job(self, name: str, input_dict: dict, send_email: bool = True) -> str:
|
|
30
|
-
"""Submit a job to the queue."""
|
|
31
|
-
data = {"name": name, "input_dict": input_dict, "send_email": send_email}
|
|
32
|
-
self.send_request("post", "job", data)
|
|
33
|
-
|
|
34
|
-
if self.response.status_code != HTTPStatus.CREATED:
|
|
35
|
-
raise ValueError("Job submission failed. Check out client.request for more info.")
|
|
36
|
-
|
|
37
|
-
data = self.response.json()
|
|
38
|
-
return data["uuid"]
|
|
39
|
-
|
|
40
|
-
def retrieve_job(self, uuid: str):
|
|
41
|
-
"""Retrieve a job from server with given id and load job as calculation object."""
|
|
42
|
-
self.send_request("get", f"job/{uuid}/get_full_job/")
|
|
43
|
-
|
|
44
|
-
if self.response.status_code != HTTPStatus.OK:
|
|
45
|
-
raise ValueError(
|
|
46
|
-
"Job retrieval failed. Check out client.session.request for more info."
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
data = self.response.json()
|
|
50
|
-
|
|
51
|
-
if data.get("job_status") != "successful" or not data.get("results", {}).get("data"):
|
|
52
|
-
warnings.warn(
|
|
53
|
-
"This job is not completed or successful. Loading only input-dict...", stacklevel=2
|
|
54
|
-
)
|
|
55
|
-
calculation = qt_calphad.load_calculation(data.get("input_dict"), {}, [])
|
|
56
|
-
else:
|
|
57
|
-
try:
|
|
58
|
-
calculation = qt_calphad.load_calculation(
|
|
59
|
-
data.get("input_dict"), data.get("results", {}).get("data"), plots=[]
|
|
60
|
-
)
|
|
61
|
-
except Exception as e:
|
|
62
|
-
warnings.warn(f"Failed to load full calculation: {e}", stacklevel=2)
|
|
63
|
-
warnings.warn("Loading only input-dict...", stacklevel=2)
|
|
64
|
-
calculation = qt_calphad.load_calculation(data.get("input_dict"), {}, [])
|
|
65
|
-
|
|
66
|
-
return calculation
|
|
67
|
-
|
|
68
|
-
def delete_job(self, uuid: str) -> None:
|
|
69
|
-
"""Delete a job with known id."""
|
|
70
|
-
self.send_request("delete", f"job/{uuid}")
|
|
71
|
-
|
|
72
|
-
if self.response.status_code != HTTPStatus.NO_CONTENT:
|
|
73
|
-
raise ValueError("Job deletion failed. Make sure you have the permission to delete.")
|
|
74
|
-
|
|
75
|
-
def list_my_jobs(self, jupyter=True) -> pd.DataFrame | Styler:
|
|
76
|
-
"""List all jobs belong to current user."""
|
|
77
|
-
self.send_request("get", "job/my_jobs")
|
|
78
|
-
data = self.response.json()
|
|
79
|
-
df_data = pd.DataFrame(data)
|
|
80
|
-
|
|
81
|
-
if jupyter:
|
|
82
|
-
df_data.insert(0, "icmd", "")
|
|
83
|
-
df_data["icmd"] = df_data.apply(lambda row: get_icmd_url(row), axis=1)
|
|
84
|
-
|
|
85
|
-
return df_data.style.format(qt_job_table_style).hide(axis="index")
|
|
86
|
-
return df_data
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def get_icmd_url(row):
|
|
90
|
-
"""Generate url endpoints for each df row."""
|
|
91
|
-
if row["type"] in ["point", "step", "grid"]:
|
|
92
|
-
return f'/simulation_calphad/equilibrium/{row["uuid"]}'
|
|
93
|
-
return f'/simulation_calphad/{row["type"]}/{row["uuid"]}'
|
|
File without changes
|
|
File without changes
|