描述待定。
项目描述
aiida-calcmonitor
AiiDA插件,其中包含用于监控正在进行计算的工具。
开发安装
git clone git@github.com:ramirezfranciscof/aiida-calcmonitor.git .
cd aiida-calcmonitor
pip install --upgrade pip
pip install -e .
# These are not available yet!
pip install -e .[pre-commit,testing] # install extra dependencies
pre-commit install # install pre-commit hooks
pytest -v # discover and run all tests
运行监控测试
要运行监控测试,您需要有一个现有的aiida配置文件。您必须在其中运行toymodel代码的计算机上进行设置(需要将aiida_calcmonitor/utils/toymodel_code.sh
复制到计算机中,并在AiiDA中设置一个代码)。您可以像这样设置本地主机:
$ verdi computer setup -L localhost -H localhost -T local -S direct -w /scratch/{username}/aiida/ --mpiprocs-per-machine 1 -n
$ verdi computer configure local localhost --safe-interval 5 -n
要运行calcjob监控calcjob,您需要设置一个特殊类型的本地主机,使用以下Mpirun命令:verdi -p <PROFILE_NAME> run
(将<PROFILE_NAME>
替换为相应的名称)。它还需要一个前置命令,以激活aiida使用的虚拟环境。对于典型的Python虚拟环境,您可以这样做:
source /home/username/.virtualenvs/aiida/bin/activate
一旦所有这些设置完成,您可以使用/examples/example01/submit_everything.py
中的示例作为模板,了解如何准备和提交toymodel计算并进行监控。
创建您自己的监控器
要创建您自己的监控器,您需要从MonitorBase
类进行子类化。这是一个从Dict
派生出来的数据类型,所以您的想法是创建一个子数据类型,该类型具有描述检查过程的方法,然后您将从这个子类型创建一个数据节点,其中包含该过程选项的字典,监控代码将获取该数据节点输入并调用检查方法。
这是一个示例,用于展示可以从父类访问的关键变量(self[...]
)以及需要使用的返回值,但结构可以根据需要修改(例如,不需要设置和使用error_detected
布尔值,您可以在检查过程中直接返回错误信息)。
class NewMonitorSubclass(MonitorBase): # pylint: disable=too-many-ancestors
"""Example of monitor for the toy model."""
def monitor_analysis(self):
sources = self['sources']
# this contains the mapping to the actual filepaths (see below)
options = self['options']
# this contains the specific options for this method (the structure is determined here in this method and the user must know what is expected when constructing it)
retrieve = self['retrieve']
# there will also be a list of files to retrieve if the original calculation is killed, but this should probably not be needed here
internal_naming = sources['internal_naming']['filepath']
# This is how you access the mapping for the files; now internal_naming contains the actual path to the file it requires
with open(internal_naming) as fileobj:
# Here one performs the parsing of the files and checking.
# Setups the variables error_detected and error_msg or equivalent
if error_detected:
return f'An error was detected: {error_msg}'
# The calcjob_monitor will interpret string returns as errors and will kill the process
else:
return None
# The calcjob_monitor will interpret None returns to mean everything is going fine
为了可以使用,您还需要将其添加为入口点/插件,例如在pyproject.toml
内部。
[project.entry-points."aiida.data"]
"calcmonitor.monitor.toymodel" = "aiida_calcmonitor.data.monitors.monitor_toymodel:MonitorToymodel"
"calcmonitor.monitor.newmonitor" = "aiida_calcmonitor.data.monitors.newmonitor_file:NewMonitorSubclass"
许可
MIT
项目详情
关闭
aiida_calcmonitor-0.1.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d1648730bc16df856f466805613dab79aa3b78969e0de351fa547cc0a1765ed2 |
|
MD5 | d8683c3764e0590d4b2e12378127456b |
|
BLAKE2b-256 | 35b1f12958f0e764b5ce38809fc362886996a95701965164e290a6df3347b013 |
关闭
aiida_calcmonitor-0.1.0-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | cff141b562f6c74a48cf75d2a1b7a0da2387f238f4b4dc7150e5d6e7ac4b7320 |
|
MD5 | 31b3ba9da56936e6692e4fb54ef0db84 |
|
BLAKE2b-256 | 3360c5032f381b8f1c8d0084bba3f3ace9136b7f9b29d982e1c1bb6dfd125b48 |