hpc-task 0.1.2__py3-none-any.whl → 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.
hpc_task/hpc.py CHANGED
@@ -79,7 +79,7 @@ class HPCTask:
79
79
  abs_workdir = stdout.read().decode('utf-8').strip().split()[-1]
80
80
  workdir = Path(abs_workdir).relative_to(Path(self._remote_parent_workdir))
81
81
  if self.workdir is None:
82
- self.workdir = str(workdir)
82
+ self.workdir = workdir.as_posix()
83
83
  return self.workdir
84
84
 
85
85
  @property
@@ -292,7 +292,6 @@ class HPCTask:
292
292
  print(f"Waiting for the queue 10 seconds...")
293
293
  sleep(10)
294
294
  status = self.status
295
- need_sync = False
296
295
  elif status in ('SUSPENDED', 'DONE'):
297
296
  output = ''
298
297
  err = f"Job {self.jobid} status: {status}"
@@ -327,12 +326,12 @@ class HPCTask:
327
326
  rel_path = Path(root).relative_to(local_path)
328
327
  remote_dir = remote_path / rel_path
329
328
  if str(rel_path) != ".":
330
- _ensure_remote_dir_exists(sftp_client, str(remote_dir))
329
+ _ensure_remote_dir_exists(sftp_client, remote_dir.as_posix())
331
330
  # 上传文件
332
331
  for file in files:
333
332
  local_file = Path(root) / file
334
333
  remote_file = remote_dir / file
335
- sftp_client.put(str(local_file), str(remote_file), confirm=False)
334
+ sftp_client.put(local_file.as_posix(), remote_file.as_posix(), confirm=False)
336
335
 
337
336
  return None
338
337
 
@@ -365,13 +364,14 @@ def _ensure_remote_dir_exists(sftp, remote_dir):
365
364
  except FileNotFoundError:
366
365
  # 递归创建目录
367
366
  parts = Path(remote_dir).parts
368
- current_path = parts[0]
367
+ current_path = Path(parts[0])
369
368
  for part in parts[1:]: # 跳过根目录
370
- current_path = os.path.join(current_path, part)
369
+ # current_path = os.path.join(current_path, part)
370
+ current_path = current_path / part
371
371
  try:
372
- sftp.stat(current_path)
372
+ sftp.stat(current_path.as_posix())
373
373
  except FileNotFoundError:
374
- sftp.mkdir(current_path)
374
+ sftp.mkdir(current_path.as_posix())
375
375
 
376
376
  def _download_dir(sftp, remote, local):
377
377
  os.makedirs(local, exist_ok=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hpc_task
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: HPC Task python library.
5
5
  Home-page: https://gitee.com/pjren/hpc_task
6
6
  Author: Renpj
@@ -61,13 +61,14 @@ hpc.close() # 此时可以关闭 ssh 通道
61
61
  # 在运行时候再重新构造和连接 hpc
62
62
  hpc = HPCTask(jobid=jobid) # workdir 会根据 jobid 提取得到
63
63
  hpc.connect(target_host)
64
-
64
+ hpc.get_workdir()
65
65
  # 结构、计算参数设置
66
66
  atoms = ase.Atoms('N2', positions=[(0., 0., 0.), (1.4, 0., 0.)],
67
67
  cell=[10, 10, 10], pbc=True)
68
68
  # calc 设置
69
69
  calc = hpc_Vasp(
70
70
  xc='pbe',
71
+ directory=hpc.workdir, # 必须设置, 会新建文件夹,并进入文件夹执行命令
71
72
  command='mpirun -np 8 vasp544_std', # 必须设置,或者提供了 ASE vasp 的相关设置
72
73
  hpctask=hpc, # 这个非常关键,必须提供
73
74
  gamma=True,
@@ -1,11 +1,11 @@
1
1
  hpc_task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- hpc_task/hpc.py,sha256=LKgxvHjymGzA287sZJJt4XrpnpjhgMMlBrMd55fpVBE,15152
2
+ hpc_task/hpc.py,sha256=nAf7dpoNh9gopk4GbYyPACvtZTCtwe8KfhR0h1pR0Nk,15219
3
3
  hpc_task/hpc_calculator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  hpc_task/hpc_calculator/lasp.py,sha256=HD-DCyXoP0C3zuhgB8Da94QrADyZlrIa-ZlcFPvlpnQ,1059
5
5
  hpc_task/hpc_calculator/vasp.py,sha256=ipFqlFIDQNAa6DI51lwvY9hlacZ-Fdp2tZe16xDqjF0,1418
6
6
  hpc_task/templates/__init__.py,sha256=qLeR7AflskortkH8K4eXnRvINl3otLLKHhTNO6Wnh8Q,695
7
- hpc_task-0.1.2.dist-info/licenses/LICENSE,sha256=iEk8UVtFW_L7ddFiCE_WFUjbOCaVc5fwNapeDmeY0WA,1063
8
- hpc_task-0.1.2.dist-info/METADATA,sha256=_7d5ZpZnZ9rkJWzJwhSKxpZFuqOyRe3IK6azeFp9M-I,2114
9
- hpc_task-0.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
- hpc_task-0.1.2.dist-info/top_level.txt,sha256=6mflaHAkVGFi5mREsN5zh0KOO13pTNrTBRAAcwmHMVA,9
11
- hpc_task-0.1.2.dist-info/RECORD,,
7
+ hpc_task-0.1.3.dist-info/licenses/LICENSE,sha256=iEk8UVtFW_L7ddFiCE_WFUjbOCaVc5fwNapeDmeY0WA,1063
8
+ hpc_task-0.1.3.dist-info/METADATA,sha256=rx9YJYIE6i9GBhQA9OwOhCpe9VugMuZc-EwMkjp6Wcs,2235
9
+ hpc_task-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
+ hpc_task-0.1.3.dist-info/top_level.txt,sha256=6mflaHAkVGFi5mREsN5zh0KOO13pTNrTBRAAcwmHMVA,9
11
+ hpc_task-0.1.3.dist-info/RECORD,,