From 03d25dc2259b3b394f232ec18993f0d6d81415eb Mon Sep 17 00:00:00 2001 From: "rodrigo.mejia" <rodrigo.mejia@kit.edu> Date: Mon, 3 Mar 2025 18:55:29 +0100 Subject: [PATCH 1/5] docs(faqs): add entry to configure custom datastore_config in res_config --- docs/faqs.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/faqs.md b/docs/faqs.md index d368bfbd..ff4d5f81 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -26,4 +26,19 @@ cfg.default_worker.accounts.append(None) cfg.default_worker.default_account = None cfg.to_file(get_resconfig_loc()) ``` -Then run `texts` again. Then use the [variable update](scl.md#dealing-with-failures) (using `:=`) to inforce re-evaluation of the resources. A simple `%rerun var` will not be sufficient. \ No newline at end of file +Then run `texts` again. Then use the [variable update](scl.md#dealing-with-failures) (using `:=`) to inforce re-evaluation of the resources. A simple `%rerun var` will not be sufficient. + +**Q**: How can I set a datastore configuration alternative to the default `$HOME/.fireworks/datastore_config.yaml`? + +**A**: This can be done using the [vre-middleware's](https://vre-middleware.readthedocs.io/en/latest/resconfig.html) Python API. For example, within an iPython command line session: +```python +from os import path +from virtmat.middleware.resconfig import get_resconfig_loc, ResConfig, WorkerConfig +cfg = ResConfig.from_file(get_resconfig_loc()) +wcfg = cfg.workers[0] +wcfg.envvars = {'DATASTORE_CONFIG': '/alternative/path_to/my_project/datastore_config.yaml'} +wcfg.default_envvars = ['DATASTORE_CONFIG'] +cfg.default_worker = wcfg +cfg.to_file(get_resconfig_loc()) + +``` -- GitLab From 0e98b2e3e0eb31535f60f76efe58f3655cdcea14 Mon Sep 17 00:00:00 2001 From: Ivan Kondov <ivan.kondov@kit.edu> Date: Tue, 4 Mar 2025 07:58:34 +0000 Subject: [PATCH 2/5] correct link formatting --- docs/io.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/io.md b/docs/io.md index 98248840..b3b53275 100644 --- a/docs/io.md +++ b/docs/io.md @@ -87,7 +87,7 @@ The default path of the datastore configuration file is `$HOME/.fireworks/datast export DATASTORE_CONFIG=/path/to/datastore_config.yaml ``` -before running the `texts` tool. If the variable `$DATASTORE_CONFIG` should be used then it has to also be added to the `default_envvars` list in the relevant worker as described (here)[https://vre-middleware.readthedocs.io/en/latest/resconfig.html#configuration-of-environment-variables]. +before running the `texts` tool. If the variable `$DATASTORE_CONFIG` should be used then it has to also be added to the `default_envvars` list in the relevant worker as described [here](https://vre-middleware.readthedocs.io/en/latest/resconfig.html#configuration-of-environment-variables). It is not recommended to set `inline-threshold` to very small values, unless you are testing. -- GitLab From 414a4e331fd7d556ee83dded921cd2dd840d54cb Mon Sep 17 00:00:00 2001 From: Rodrigo Cortes Mejia <rodrigo.mejia@kit.edu> Date: Tue, 4 Mar 2025 16:32:03 +0000 Subject: [PATCH 3/5] docs(faqs): cleanup python code for custom datastore_config --- docs/faqs.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/faqs.md b/docs/faqs.md index ff4d5f81..6dfb28ff 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -32,13 +32,11 @@ Then run `texts` again. Then use the [variable update](scl.md#dealing-with-failu **A**: This can be done using the [vre-middleware's](https://vre-middleware.readthedocs.io/en/latest/resconfig.html) Python API. For example, within an iPython command line session: ```python -from os import path -from virtmat.middleware.resconfig import get_resconfig_loc, ResConfig, WorkerConfig -cfg = ResConfig.from_file(get_resconfig_loc()) +from virtmat.middleware.resconfig import get_resconfig_loc, resconfig +cfg = resconfig.get_default_resconfig() wcfg = cfg.workers[0] -wcfg.envvars = {'DATASTORE_CONFIG': '/alternative/path_to/my_project/datastore_config.yaml'} -wcfg.default_envvars = ['DATASTORE_CONFIG'] +wcfg.envvars.update({'DATASTORE_CONFIG': '/alternative/path_to/my_project/datastore_config.yaml'}) +wcfg.default_envvars.append('DATASTORE_CONFIG') cfg.default_worker = wcfg cfg.to_file(get_resconfig_loc()) - ``` -- GitLab From 120700ca20f4c8b4506686dfc90421798aa96902 Mon Sep 17 00:00:00 2001 From: Rodrigo Cortes Mejia <rodrigo.mejia@kit.edu> Date: Tue, 4 Mar 2025 17:37:35 +0000 Subject: [PATCH 4/5] docs(faqs): polish python code for datastore --- docs/faqs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/faqs.md b/docs/faqs.md index 6dfb28ff..c714ebd4 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -32,8 +32,8 @@ Then run `texts` again. Then use the [variable update](scl.md#dealing-with-failu **A**: This can be done using the [vre-middleware's](https://vre-middleware.readthedocs.io/en/latest/resconfig.html) Python API. For example, within an iPython command line session: ```python -from virtmat.middleware.resconfig import get_resconfig_loc, resconfig -cfg = resconfig.get_default_resconfig() +from virtmat.middleware.resconfig import get_resconfig_loc, get_default_resconfig +cfg = get_default_resconfig() wcfg = cfg.workers[0] wcfg.envvars.update({'DATASTORE_CONFIG': '/alternative/path_to/my_project/datastore_config.yaml'}) wcfg.default_envvars.append('DATASTORE_CONFIG') -- GitLab From e4c9ab4b8f60aca17945d38ceb8c4623d96c589e Mon Sep 17 00:00:00 2001 From: Rodrigo Cortes Mejia <rodrigo.mejia@kit.edu> Date: Wed, 5 Mar 2025 14:32:01 +0000 Subject: [PATCH 5/5] docs(faqs): worker note in datastore entry --- docs/faqs.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/faqs.md b/docs/faqs.md index c714ebd4..65a45a69 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -34,9 +34,11 @@ Then run `texts` again. Then use the [variable update](scl.md#dealing-with-failu ```python from virtmat.middleware.resconfig import get_resconfig_loc, get_default_resconfig cfg = get_default_resconfig() -wcfg = cfg.workers[0] +wcfg = cfg.workers[0] # SEE NOTE wcfg.envvars.update({'DATASTORE_CONFIG': '/alternative/path_to/my_project/datastore_config.yaml'}) wcfg.default_envvars.append('DATASTORE_CONFIG') cfg.default_worker = wcfg cfg.to_file(get_resconfig_loc()) ``` + +**NOTE:** In this example `worker[0]` is assumed as the relevant worker for the datastore configuration. If available, other workers can be selected by using the corresponding index, eg `worker[n]`. \ No newline at end of file -- GitLab