ffunrun 0.1.3__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.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: ffunrun
3
+ Version: 0.1.3
4
+ Summary: funrun
5
+ Author-email: niuliangtao <farfarfun@qq.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # funrun
@@ -0,0 +1,7 @@
1
+ funrun/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ funrun/run.py,sha256=Aail57M6FMPdGwR8QRJl1NPWaHD7_9Ql2RUoh-C5Ldk,1483
3
+ ffunrun-0.1.3.dist-info/METADATA,sha256=fZL7u9XuxW-ellveMp0I4mT92df-Qt0R30BS4bCKG8Y,185
4
+ ffunrun-0.1.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
5
+ ffunrun-0.1.3.dist-info/entry_points.txt,sha256=SlCOrZy0LiLELoMIMwnoe75CeQPh-iPx47Agxu9Qxo4,47
6
+ ffunrun-0.1.3.dist-info/top_level.txt,sha256=PtZgHIcCmfDI5BDGqBZkd_L76-I8KPoiGrxr6DEVrpw,7
7
+ ffunrun-0.1.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (78.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ funrun = funrun.run:run_task
@@ -0,0 +1 @@
1
+ funrun
funrun/__init__.py ADDED
File without changes
funrun/run.py ADDED
@@ -0,0 +1,49 @@
1
+ """
2
+ #!/bin/bash
3
+ task_root='/work/home/liuc12/workbench'
4
+ timestamp=$(date +"%Y%m%d%H%M%S")
5
+ task_dir="$task_root/task_$timestamp"
6
+
7
+ mkdir "$task_dir"
8
+ cp -r *.cpp *.h *.sh *.slurm *.f90 *.dat $task_dir 2>/dev/null
9
+ cd "$task_dir"
10
+ pwd
11
+ #ls -al
12
+ sbatch config.slurm
13
+ """
14
+
15
+ import os
16
+ from datetime import datetime
17
+
18
+ import click
19
+ from funbuild.shell import run_shell
20
+ from funutil import getLogger
21
+
22
+ logger = getLogger("funbuild")
23
+
24
+
25
+ @click.command()
26
+ def run_task():
27
+ task_dir = os.path.join(
28
+ os.environ["HOME"], "/workbench", datetime.now().strftime("%Y%m%d%H%M%S")
29
+ )
30
+ logger.info(f"任务主目录:{task_dir}")
31
+ os.makedirs(task_dir, exist_ok=True)
32
+ logger.info(f"step1: 复制文件到任务主目录:{task_dir}")
33
+ run_shell(f"cp -r *.cpp *.h *.sh *.slurm *.f90 *.dat {task_dir} 2>/dev/null")
34
+
35
+ task_name = "lbm-" + input("请输入任务名字")
36
+
37
+ if os.path.exists("config.slurm"):
38
+ logger.info("step2: 检测到config.slurm文件,提交任务")
39
+ run_shell(f"cd {task_dir} && sbatch config.slurm")
40
+ elif os.path.exists("main.cpp"):
41
+ logger.info("step2: 检测到main.cpp文件,编译")
42
+ run_shell(f"cd {task_dir} && g++ main.cpp -o task.app")
43
+ logger.info("step3: 编译完成,开始执行")
44
+ run_shell(
45
+ f"cd {task_dir} && nohup exec -a {task_name} ./task.app > output.log 2>&1 &"
46
+ )
47
+ else:
48
+ logger.error("找不到需要提交的任务")
49
+ logger.info("任务提交完成")