oh-my-batch 0.2.0__tar.gz → 0.2.1__tar.gz
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.
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/PKG-INFO +16 -2
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/README.md +15 -1
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/assets/functions.sh +16 -1
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/cli.py +3 -0
- oh_my_batch-0.2.1/oh_my_batch/misc.py +14 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/pyproject.toml +1 -2
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/LICENSE +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/__init__.py +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/__main__.py +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/assets/__init__.py +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/batch.py +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/combo.py +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/job.py +0 -0
- {oh_my_batch-0.2.0 → oh_my_batch-0.2.1}/oh_my_batch/util.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: oh-my-batch
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.1
|
4
4
|
Summary:
|
5
5
|
License: GPL
|
6
6
|
Author: weihong.xu
|
@@ -22,19 +22,33 @@ Description-Content-Type: text/markdown
|
|
22
22
|
[](https://pypi.org/project/oh-my-batch/)
|
23
23
|
[](https://pypi.org/project/oh-my-batch/)
|
24
24
|
|
25
|
-
A
|
25
|
+
A toolkit to manipulate batch tasks with command line. Designed for scientific computing community.
|
26
26
|
|
27
27
|
## Features
|
28
28
|
* `omb combo`: generate folders/files from different combinations of parameters
|
29
29
|
* `omb batch`: generate batch scripts from multiple working directories
|
30
30
|
* `omb job`: track the state of job in job schedular
|
31
31
|
|
32
|
+
## Shell Tips
|
33
|
+
`oh-my-batch` is intended to help you implement computational workflows with shell scripts.
|
34
|
+
To make the best use of `oh-my-batch`, you need to know some shell tips.
|
35
|
+
|
36
|
+
* [Retry commands until success in shell script](https://stackoverflow.com/a/79191004/3099733)
|
37
|
+
|
32
38
|
## Install
|
33
39
|
```bash
|
34
40
|
pip install oh-my-batch
|
35
41
|
```
|
36
42
|
|
37
43
|
## Use cases
|
44
|
+
### Load useful functions to your shell script
|
45
|
+
You can load useful functions from `oh-my-batch` this way:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
omb misc export-shell-func > omb-func.sh && source omb-func.sh
|
49
|
+
```
|
50
|
+
|
51
|
+
This will load some useful functions to your shell script, for example, `checkpoint` function.
|
38
52
|
|
39
53
|
### Generate files from different combinations of parameters
|
40
54
|
|
@@ -4,19 +4,33 @@
|
|
4
4
|
[](https://pypi.org/project/oh-my-batch/)
|
5
5
|
[](https://pypi.org/project/oh-my-batch/)
|
6
6
|
|
7
|
-
A
|
7
|
+
A toolkit to manipulate batch tasks with command line. Designed for scientific computing community.
|
8
8
|
|
9
9
|
## Features
|
10
10
|
* `omb combo`: generate folders/files from different combinations of parameters
|
11
11
|
* `omb batch`: generate batch scripts from multiple working directories
|
12
12
|
* `omb job`: track the state of job in job schedular
|
13
13
|
|
14
|
+
## Shell Tips
|
15
|
+
`oh-my-batch` is intended to help you implement computational workflows with shell scripts.
|
16
|
+
To make the best use of `oh-my-batch`, you need to know some shell tips.
|
17
|
+
|
18
|
+
* [Retry commands until success in shell script](https://stackoverflow.com/a/79191004/3099733)
|
19
|
+
|
14
20
|
## Install
|
15
21
|
```bash
|
16
22
|
pip install oh-my-batch
|
17
23
|
```
|
18
24
|
|
19
25
|
## Use cases
|
26
|
+
### Load useful functions to your shell script
|
27
|
+
You can load useful functions from `oh-my-batch` this way:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
omb misc export-shell-func > omb-func.sh && source omb-func.sh
|
31
|
+
```
|
32
|
+
|
33
|
+
This will load some useful functions to your shell script, for example, `checkpoint` function.
|
20
34
|
|
21
35
|
### Generate files from different combinations of parameters
|
22
36
|
|
@@ -1,6 +1,7 @@
|
|
1
|
+
GREEN='\033[0;32m'
|
2
|
+
NC='\033[0m'
|
1
3
|
|
2
4
|
checkpoint() {
|
3
|
-
# Usage: checkpoint <flag_file> <command> [arg1] [arg2] ...
|
4
5
|
local flag_file="$1"
|
5
6
|
shift # Remove the first argument so $@ contains only the command and its arguments
|
6
7
|
if [ -f "$flag_file" ]; then
|
@@ -10,6 +11,7 @@ checkpoint() {
|
|
10
11
|
local exit_code=$?
|
11
12
|
if [ $exit_code -eq 0 ]; then
|
12
13
|
local current_time=$(date '+%Y-%m-%d %H:%M:%S')
|
14
|
+
mkdir -p "$(dirname "$flag_file")"
|
13
15
|
printf 'Command succeeded at %s\n' "$current_time" > "$flag_file"
|
14
16
|
echo "Created flag file '$flag_file' with timestamp: $current_time"
|
15
17
|
else
|
@@ -18,3 +20,16 @@ checkpoint() {
|
|
18
20
|
fi
|
19
21
|
fi
|
20
22
|
}
|
23
|
+
|
24
|
+
echo -e "${GREEN}Functiion: checkpoint${NC}"
|
25
|
+
cat <<EOF
|
26
|
+
Usage:
|
27
|
+
checkpoint <flag_file> <command> [arg1] [arg2] ...
|
28
|
+
|
29
|
+
Set a flag file to indicate the completion of a command,
|
30
|
+
so that it will not be executed again next time.
|
31
|
+
|
32
|
+
Example:
|
33
|
+
checkpoint lmp.done lmp -in in.lmp
|
34
|
+
|
35
|
+
EOF
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from .assets import get_asset
|
2
|
+
|
3
|
+
class Misc:
|
4
|
+
|
5
|
+
def export_shell_func(self):
|
6
|
+
"""
|
7
|
+
Export shell functions for batch scripts
|
8
|
+
|
9
|
+
For example, you can load them to you shell environment with the following command:
|
10
|
+
omb misc export-shell-func > omb-func.sh && source omb-func.sh
|
11
|
+
"""
|
12
|
+
shell_func = get_asset('functions.sh')
|
13
|
+
with open(shell_func, 'r', encoding='utf-8') as f:
|
14
|
+
print(f.read())
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "oh-my-batch"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.1"
|
4
4
|
description = ""
|
5
5
|
authors = ["weihong.xu <xuweihong.cn@gmail.com>"]
|
6
6
|
license = "GPL"
|
@@ -11,7 +11,6 @@ packages = [{include = "oh_my_batch"}]
|
|
11
11
|
python = "^3.8"
|
12
12
|
fire = "^0.7.0"
|
13
13
|
|
14
|
-
|
15
14
|
[build-system]
|
16
15
|
requires = ["poetry-core"]
|
17
16
|
build-backend = "poetry.core.masonry.api"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|