Commit 67a91e11 authored by Anton Pershin's avatar Anton Pershin

Changed config name to user-specific one

parent a4d8f648
...@@ -159,7 +159,7 @@ class LocalCommunication(BaseCommunication): ...@@ -159,7 +159,7 @@ class LocalCommunication(BaseCommunication):
@classmethod @classmethod
def create_from_config(cls): def create_from_config(cls):
with open('config_research.json', 'r') as f: with open(os.path.expanduser('~/.comsdk/config_research.json'), 'r') as f:
conf = json.load(f) conf = json.load(f)
local_host = Host() local_host = Host()
_add_programs_and_commands_from_config(local_host, conf['LOCAL_HOST']) _add_programs_and_commands_from_config(local_host, conf['LOCAL_HOST'])
...@@ -212,7 +212,7 @@ class SshCommunication(BaseCommunication): ...@@ -212,7 +212,7 @@ class SshCommunication(BaseCommunication):
@classmethod @classmethod
def create_from_config(cls, host_sid): def create_from_config(cls, host_sid):
with open('config_research.json', 'r') as f: with open(os.path.expanduser('~/.comsdk/config_research.json'), 'r') as f:
conf = json.load(f) conf = json.load(f)
hostconf = conf['REMOTE_HOSTS'][host_sid] hostconf = conf['REMOTE_HOSTS'][host_sid]
remote_host = RemoteHost(ssh_host=hostconf['ssh_host'], remote_host = RemoteHost(ssh_host=hostconf['ssh_host'],
......
...@@ -437,7 +437,7 @@ def build_args_line(data, keyword_names, flag_names, trailing_args_keys): ...@@ -437,7 +437,7 @@ def build_args_line(data, keyword_names, flag_names, trailing_args_keys):
def render_sge_template(sge_template_name, sge_script_path, cores, time, commands): def render_sge_template(sge_template_name, sge_script_path, cores, time, commands):
with open('config_research.json', 'r') as f: with open(os.path.expanduser('~/.comsdk/config_research.json'), 'r') as f:
conf = json.load(f) conf = json.load(f)
sge_templ_path = os.path.join(conf['TEMPLATES_PATH'], sge_template_name) sge_templ_path = os.path.join(conf['TEMPLATES_PATH'], sge_template_name)
if not os.path.exists(sge_templ_path): # by default, templates are in templates/, but here we let the user put any path if not os.path.exists(sge_templ_path): # by default, templates are in templates/, but here we let the user put any path
......
...@@ -89,7 +89,7 @@ class Research: ...@@ -89,7 +89,7 @@ class Research:
:param remote_comm: BaseCommunication instance used for communication with remote machine :param remote_comm: BaseCommunication instance used for communication with remote machine
:return: new Research instance :return: new Research instance
""" """
with open('config_research.json', 'r') as f: with open(os.path.expanduser('~/.comsdk/config_research.json'), 'r') as f:
conf = json.load(f) conf = json.load(f)
res = Research(conf['RESEARCH'][research_id], res = Research(conf['RESEARCH'][research_id],
continuing=True, continuing=True,
...@@ -109,7 +109,7 @@ class Research: ...@@ -109,7 +109,7 @@ class Research:
:param remote_comm: BaseCommunication instance used for communication with remote machine :param remote_comm: BaseCommunication instance used for communication with remote machine
:return: new Research instance :return: new Research instance
""" """
with open('config_research.json', 'r+') as f: with open(os.path.expanduser('~/.comsdk/config_research.json'), 'r+') as f:
conf = json.load(f) conf = json.load(f)
conf['RESEARCH'][new_research_id] = make_suitable_research_dir(new_research_descr) conf['RESEARCH'][new_research_id] = make_suitable_research_dir(new_research_descr)
f.seek(0) f.seek(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment