Skip to content

Commit

Permalink
v0.0.6 add Controller.rcwd() for runtime access [NEED_TEST]
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Feb 8, 2023
1 parent fc4fac3 commit 7d27b49
Show file tree
Hide file tree
Showing 9 changed files with 388 additions and 81 deletions.
219 changes: 158 additions & 61 deletions PYPE.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions PYPE.json.last
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ts_init": "2022-12-13T17:57:52.663076",
"ts_init": "2022-12-13T17:58:04.833908",
"name": "_PYPE_START",
"co_name": null,
"suc": 1,
Expand All @@ -9,24 +9,24 @@
"source": [],
"extra_dict": {},
"last_run": {
"ts_init": "2022-12-13T17:57:52.663101",
"ts_init": "2022-12-13T17:58:04.833927",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2022-12-13T17:57:52.663104"
"endtime": "2022-12-13T17:58:04.833930"
},
"save_run": {
"ts_init": "2022-12-13T17:57:52.663109",
"ts_init": "2022-12-13T17:58:04.833934",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2022-12-13T17:57:52.663111"
"endtime": "2022-12-13T17:58:04.833936"
}
}
{
"ts_init": "2022-12-13T17:57:52.789517",
"ts_init": "2022-12-13T17:58:04.952943",
"name": "lazy_apt_install/0",
"co_name": "know_my_cli",
"suc": 1,
Expand All @@ -38,9 +38,9 @@
],
"extra_dict": {},
"last_run": {
"ts_init": "2022-12-13T17:57:52.774204",
"ts_init": "2022-12-13T17:58:04.938496",
"suc": 1,
"dur_ms": 101,
"dur_ms": 97,
"stdout": [
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b/[Elapsed]/ 0.0s"
],
Expand All @@ -51,7 +51,7 @@
" ctl.lazy_apt_install('nano git proxychains4'.split())",
"[CHCK][SKIP]"
],
"endtime": "2022-12-13T17:57:52.774168"
"endtime": "2022-12-13T17:58:04.938454"
},
"save_run": {
"ts_init": "2022-12-13T17:56:57.692761",
Expand All @@ -63,7 +63,7 @@
}
}
{
"ts_init": "2022-12-13T17:57:52.837669",
"ts_init": "2022-12-13T17:58:05.004790",
"name": "lazy_git/1",
"co_name": "know_my_cli",
"suc": 1,
Expand All @@ -75,7 +75,7 @@
],
"extra_dict": {},
"last_run": {
"ts_init": "2022-12-13T17:57:52.822349",
"ts_init": "2022-12-13T17:58:04.986230",
"suc": 1,
"dur_ms": 32,
"stdout": [
Expand All @@ -91,7 +91,7 @@
"[cmd]set -e; git -C temp_pype rev-parse HEAD",
"[SKIP]"
],
"endtime": "2022-12-13T17:57:52.822312"
"endtime": "2022-12-13T17:58:04.986189"
},
"save_run": {
"ts_init": "2022-12-13T17:56:57.736812",
Expand All @@ -103,7 +103,7 @@
}
}
{
"ts_init": "2022-12-13T17:57:52.838362",
"ts_init": "2022-12-13T17:58:05.005976",
"name": "_PYPE_END",
"co_name": null,
"suc": 1,
Expand All @@ -113,19 +113,19 @@
"source": [],
"extra_dict": {},
"last_run": {
"ts_init": "2022-12-13T17:57:52.838378",
"ts_init": "2022-12-13T17:58:05.006003",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2022-12-13T17:57:52.838382"
"endtime": "2022-12-13T17:58:05.006008"
},
"save_run": {
"ts_init": "2022-12-13T17:57:52.838388",
"ts_init": "2022-12-13T17:58:05.006017",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2022-12-13T17:57:52.838396"
"endtime": "2022-12-13T17:58:05.006019"
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
- fix lazy_url to use absolute path
- fix Controller.lazy_git_url_commit()
- 需要检查的文件操作: open, shutil, os.chdir ,ShellRun
- fix tests
- add Controller.rcwd() for runtime access [NEED_TEST]
- 20221027 v0.0.4

## Installation:
Expand Down
101 changes: 101 additions & 0 deletions examples/PYPE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"ts_init": "2023-02-08T12:43:17.361845",
"name": "_PYPE_START",
"co_name": null,
"suc": 1,
"skipped": -1,
"file": null,
"lineno": null,
"source": [],
"extra_dict": {},
"last_run": {
"ts_init": "2023-02-08T12:43:17.361888",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.361897"
},
"save_run": {
"ts_init": "2023-02-08T12:43:17.361910",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.361917"
}
}
{
"ts_init": "2023-02-08T12:43:17.374806",
"name": "_defaul_key_0",
"co_name": "know_task",
"suc": 1,
"skipped": 0,
"file": "/home/td/repos/pype/examples/test_run.py",
"lineno": 3,
"source": [
"\tctl.RWC(run='echo [hi]')"
],
"extra_dict": {},
"last_run": {
"ts_init": "2023-02-08T12:43:17.372416",
"suc": 1,
"dur_ms": 9,
"stdout": [
"[hi]"
],
"stderr": [
"",
"[BULD](name='_defaul_key_0', code 'know_task', file='/home/td/repos/pype/examples/test_run.py', line 3)",
" File \"'/home/td/repos/pype/examples/test_run.py'\", line 3, in know_task)",
"\tctl.RWC(run='echo [hi]')",
"[CHCK][RUNN]",
"[cmd]set -e; echo [hi]"
],
"endtime": "2023-02-08T12:43:17.372323"
},
"save_run": {
"ts_init": "2023-02-08T12:43:17.372416",
"suc": 1,
"dur_ms": 9,
"stdout": [
"[hi]"
],
"stderr": [
"",
"[BULD](name='_defaul_key_0', code 'know_task', file='/home/td/repos/pype/examples/test_run.py', line 3)",
" File \"'/home/td/repos/pype/examples/test_run.py'\", line 3, in know_task)",
"\tctl.RWC(run='echo [hi]')",
"[CHCK][RUNN]",
"[cmd]set -e; echo [hi]"
],
"endtime": "2023-02-08T12:43:17.372323"
}
}
{
"ts_init": "2023-02-08T12:43:17.375520",
"name": "_PYPE_END",
"co_name": null,
"suc": 1,
"skipped": -1,
"file": null,
"lineno": null,
"source": [],
"extra_dict": {},
"last_run": {
"ts_init": "2023-02-08T12:43:17.375540",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.375547"
},
"save_run": {
"ts_init": "2023-02-08T12:43:17.375553",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.375556"
}
}
101 changes: 101 additions & 0 deletions examples/PYPE.json.last
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"ts_init": "2023-02-08T12:43:17.223504",
"name": "_PYPE_START",
"co_name": null,
"suc": 1,
"skipped": -1,
"file": null,
"lineno": null,
"source": [],
"extra_dict": {},
"last_run": {
"ts_init": "2023-02-08T12:43:17.223525",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.223529"
},
"save_run": {
"ts_init": "2023-02-08T12:43:17.223534",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.223536"
}
}
{
"ts_init": "2023-02-08T12:43:17.257687",
"name": "_defaul_key_0",
"co_name": "know_task",
"suc": 1,
"skipped": 0,
"file": "/home/td/repos/pype/examples/test_run.py",
"lineno": 3,
"source": [
"\tctl.RWC(run='echo [hi]')"
],
"extra_dict": {},
"last_run": {
"ts_init": "2023-02-08T12:43:17.256796",
"suc": 1,
"dur_ms": 29,
"stdout": [
"[hi]"
],
"stderr": [
"",
"[BULD](name='_defaul_key_0', code 'know_task', file='/home/td/repos/pype/examples/test_run.py', line 3)",
" File \"'/home/td/repos/pype/examples/test_run.py'\", line 3, in know_task)",
"\tctl.RWC(run='echo [hi]')",
"[CHCK][RUNN]",
"[cmd]set -e; echo [hi]"
],
"endtime": "2023-02-08T12:43:17.256754"
},
"save_run": {
"ts_init": "2023-02-08T12:43:17.256796",
"suc": 1,
"dur_ms": 29,
"stdout": [
"[hi]"
],
"stderr": [
"",
"[BULD](name='_defaul_key_0', code 'know_task', file='/home/td/repos/pype/examples/test_run.py', line 3)",
" File \"'/home/td/repos/pype/examples/test_run.py'\", line 3, in know_task)",
"\tctl.RWC(run='echo [hi]')",
"[CHCK][RUNN]",
"[cmd]set -e; echo [hi]"
],
"endtime": "2023-02-08T12:43:17.256754"
}
}
{
"ts_init": "2023-02-08T12:43:17.258346",
"name": "_PYPE_END",
"co_name": null,
"suc": 1,
"skipped": -1,
"file": null,
"lineno": null,
"source": [],
"extra_dict": {},
"last_run": {
"ts_init": "2023-02-08T12:43:17.258362",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.258369"
},
"save_run": {
"ts_init": "2023-02-08T12:43:17.258375",
"suc": -1,
"dur_ms": -1,
"stdout": [],
"stderr": [],
"endtime": "2023-02-08T12:43:17.258377"
}
}
Empty file added examples/PYPE.json.lock
Empty file.
Binary file modified examples/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
10 changes: 7 additions & 3 deletions pype/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,13 @@ def target_dir(self):return self._target_dir
def cwd(self):return self.rundir

@property
def runtime_cwd(self):return self.runtime['_CWD']
def runtime_cwd_getter(self):return self.runtime['_CWD']
@property
def rcwd(self):return self.runtime['_CWD']
def rcwd(self):
'''
Allow access only when compilation is done
'''
return self.runtime['_CWD'].call()


def apply(self,x):
Expand Down Expand Up @@ -1405,7 +1409,7 @@ def lazy_git_url_commit(
# target_prefix = CWD()
# target_dir = os.path.join(target_prefix,os.path.basename(url))
if target_dir is None:
target_dir = self.runtime_cwd + '/' + os.path.basename(url)
target_dir = self.runtime_cwd_getter + '/' + os.path.basename(url)
# target_dir = os.path.basename(url)
target_dir = RO(target_dir, None, FRAME(1))

Expand Down
2 changes: 2 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pype import NonConcreteValueError
from pype import PlaceHolder,ValueNotReadyError
import warnings

Controller.rcwd
#from .examples.know_my_cli import know_my_cli
#from .examples.know_my_cli import know_my_cli

Expand Down

0 comments on commit 7d27b49

Please sign in to comment.