Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ~/.jarvis for builtin directory #109

Merged
merged 11 commits into from
Jan 24, 2025
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/bin/jarvis",
"args": ["rg", "show"],
"args": ["bootstrap", "from", "local"],
"console": "integratedTerminal",
"justMyCode": false,
"env": {
Expand Down
2 changes: 1 addition & 1 deletion bin/jarvis
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ class JarvisArgs(ArgParse):
self.jarvis.save()

def resource_graph_show(self):
self.jarvis.load().resource_graph_show()
self.jarvis.resource_graph_show()
self.jarvis.save()

def resource_graph_path(self):
Expand Down
2 changes: 1 addition & 1 deletion builtin/config/ares.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ HOSTFILE: null
PRIVATE_DIR: /mnt/ssd/${USER}/jarvis-pipelines
REPOS:
- name: builtin
path: ${HOME}/jarvis-cd/builtin
path: ${HOME}/.jarvis/builtin
SHARED_DIR: ${HOME}/jarvis-pipelines
2 changes: 1 addition & 1 deletion builtin/config/deception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ HOSTFILE: null
PRIVATE_DIR: /scratch/${USER}/jarvis-pipelines # local SSD
REPOS:
- name: builtin
path: ${HOME}/jarvis-cd/builtin
path: ${HOME}/.jarvis/builtin
SHARED_DIR: ${HOME}/jarvis-pipelines
2 changes: 1 addition & 1 deletion builtin/config/polaris.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ HOSTFILE: null
PRIVATE_DIR: /tmp/${USER}/jarvis
REPOS:
- name: builtin
path: ${HOME}/SCS_lab/jarvis-cd/builtin
path: ${HOME}/.jarvis/builtin
SHARED_DIR: /lus/grand/projects/VeloC/${USER}/SCS_lab/
10 changes: 6 additions & 4 deletions jarvis_cd/basic/jarvis_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def __init__(self):
self.cur_pipeline = None
# Path to local jarvis configuration directory
self.local_config_dir = os.path.join(os.environ['HOME'], '.jarvis')
# Path to local jarvis builtin package directory
self.builtin_dir = os.path.join(self.local_config_dir, 'builtin')
# The path to the global jarvis configuration (root user)
self.jarvis_conf_path = os.path.join(self.local_config_dir,
'jarvis_config.yaml')
Expand Down Expand Up @@ -89,7 +91,7 @@ def create(self, config_dir, private_dir, shared_dir=None):
'HOSTFILE': None,
'CUR_PIPELINE': None,
}
self.add_repo(f'{self.jarvis_root}/builtin')
self.add_repo(self.builtin_dir)
self.resource_graph = ResourceGraph()
self.hostfile = Hostfile()
os.makedirs(self.local_config_dir, exist_ok=True)
Expand Down Expand Up @@ -176,13 +178,13 @@ def bootstrap_from(self, machine):
self.save()
return
os.makedirs(self.local_config_dir, exist_ok=True)
config_path = f'{self.jarvis_root}/builtin/config/{machine}.yaml'
config_path = f'{self.builtin_dir}/config/{machine}.yaml'
if os.path.exists(config_path):
config = expand_env(YamlFile(config_path).load())
new_config_path = f'{self.local_config_dir}/jarvis_config.yaml'
YamlFile(new_config_path).save(config)

rg_path = f'{self.jarvis_root}/builtin/resource_graph/{machine}.yaml'
rg_path = f'{self.builtin_dir}/resource_graph/{machine}.yaml'
if os.path.exists(rg_path):
self.resource_graph = ResourceGraph().load(rg_path)
new_rg_path = f'{self.local_config_dir}/resource_graph.yaml'
Expand All @@ -194,7 +196,7 @@ def bootstrap_list(self):

:return: None
"""
configs = os.listdir(f'{self.jarvis_root}/builtin/config')
configs = os.listdir(f'{self.builtin_dir}/config')
for config in configs:
print(config.replace('.yaml', ''))

Expand Down
1 change: 1 addition & 0 deletions logg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello World
23 changes: 14 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import setuptools
import os
import sys
import shutil
import sysconfig

setuptools.setup(

ret = setuptools.setup(
name="jarvis_cd",
packages=setuptools.find_packages(),
scripts=['bin/jarvis'],
Expand All @@ -21,13 +26,13 @@
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Application Configuration",
],
install_requires=[
# 'pyyaml',
# 'pylint==2.15.0',
# 'coverage==5.5',
# 'coverage-lcov==0.2.4',
# 'pytest==6.2.5',
#'jarvis-util @ git+https://github.com/scs-lab/jarvis-util.git#egg=jarvis-util'
]
)

# Install the builtin directory to ~/.jarvis
project_dir = os.path.dirname(os.path.realpath(__file__))
local_builtin_path = os.path.join(project_dir, 'builtin')
install_builtin_path = os.path.join(os.environ['HOME'], '.jarvis', 'builtin')
if not os.path.exists(os.path.dirname(install_builtin_path)):
os.makedirs(os.path.dirname(install_builtin_path))
shutil.copytree(local_builtin_path, install_builtin_path, dirs_exist_ok=True)
Loading