Commit ee49c1dd31cdb162750143365bb221f87abcf8f5

Authored by Alexis Koralewski
1 parent 3ee14364
Exists in dev

Add ConfigPyros to Agent.py

Showing 2 changed files with 9 additions and 5 deletions   Show diff stats
CHANGELOG
... ... @@ -2,7 +2,7 @@
2 2 - Add ephem to pickle seq & add pickle creation when submitting seq via api
3 3 - Add Filenames to ConfigPyros & add fn_contexts in config_pyros.yml
4 4 - Sequence two pickle file : one with ephem & one sequence
5   -
  5 + - Add ConfigPyros to Agent.py
6 6 06-04-2023 (AKo): v0.6.21.1
7 7 - Try to fix error when submitting seq simplified (no start_date)
8 8  
... ...
src/core/pyros_django/agent/Agent.py
... ... @@ -164,7 +164,7 @@ CmdExceptionExecTimeout = AgentCmd.CmdExceptionExecTimeout
164 164 #from config.configpyros import ConfigPyros
165 165 from config.old_config.configpyros import ConfigPyros as ConfigPyrosOld
166 166 from src.core.pyros_django.obsconfig.obsconfig_class import OBSConfig
167   -
  167 +from config.pyros.config_pyros import ConfigPyros as ConfigPyros
168 168  
169 169 #from dashboard.views import get_sunelev
170 170 #from devices.TelescopeRemoteControlDefault import TelescopeRemoteControlDefault
... ... @@ -636,7 +636,9 @@ class Agent:
636 636 path_to_obs_config_folder = os.environ["PATH_TO_OBSCONF_FOLDER"]
637 637 unit = os.environ["unit_name"]
638 638 oc = OBSConfig(obs_config_file_path,unit)
639   - self.set_config(oc, obs_config_file_path, path_to_obs_config_folder, unit)
  639 + pyros_yaml_path = os.environ["pyros_config_file"]
  640 + pyros_config = ConfigPyros(pyros_yaml_path)
  641 + self.set_config(oc, obs_config_file_path, path_to_obs_config_folder, unit, pyros_config, pyros_yaml_path)
640 642 agent_name_from_config = self.get_config().get_agent_name_from_config(self.__class__.__name__,simulated_computer)
641 643 if agent_name_from_config:
642 644 self.name = agent_name_from_config
... ... @@ -855,13 +857,15 @@ class Agent:
855 857  
856 858  
857 859  
858   - def set_config(self, oc: OBSConfig, obs_config_file_path: str, path_to_obs_config_folder: str, unit: str):
  860 + def set_config(self, oc: OBSConfig, obs_config_file_path: str, path_to_obs_config_folder: str, unit: str, pyros_config: str, pyros_yaml_path: str):
859 861 self._oc = {
860 862 'config' : oc,
  863 + 'pyros_config' : pyros_config,
861 864 'env' : [
862 865 obs_config_file_path,
863 866 path_to_obs_config_folder,
864   - unit
  867 + unit,
  868 + pyros_yaml_path
865 869 ]
866 870 }
867 871 '''
... ...