rehearsal: make the script self-contained re sys.path/cwd (E-021)
Browse files
build/smoke_hub_resume.py
CHANGED
|
@@ -23,6 +23,15 @@ import subprocess
|
|
| 23 |
import sys
|
| 24 |
import time
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
ROOT = "/kaggle/working/mixroot"
|
| 27 |
REPO = "Cion-lab/ounce100m-mix-stagetest"
|
| 28 |
TWO = "cosmopedia__khanacademy,SimpleStories__default"
|
|
|
|
| 23 |
import sys
|
| 24 |
import time
|
| 25 |
|
| 26 |
+
# Self-contained regardless of how this file is started. A kernel that fetches and exec()s this source
|
| 27 |
+
# runs from /kaggle/src with sys.path[0] pointing there, so `import ounce100m_credentials` fails even
|
| 28 |
+
# though the module is sitting in the working directory next to it (E-021).
|
| 29 |
+
WORK = "/kaggle/working"
|
| 30 |
+
for _p in (WORK, os.getcwd()):
|
| 31 |
+
if _p and _p not in sys.path:
|
| 32 |
+
sys.path.insert(0, _p)
|
| 33 |
+
os.chdir(WORK)
|
| 34 |
+
|
| 35 |
ROOT = "/kaggle/working/mixroot"
|
| 36 |
REPO = "Cion-lab/ounce100m-mix-stagetest"
|
| 37 |
TWO = "cosmopedia__khanacademy,SimpleStories__default"
|