Commit d4c2451c95675cee84b75e4a4b9eb7a6abfe5707
Exists in
dev
Merge branch 'dev' of https://gitlab.irap.omp.eu/pyros-irap/pyros into dev
Showing
5 changed files
with
24 additions
and
10 deletions
Show diff stats
config/pyros_observatory/general/schemas/schema_observatory-2.0.yml
@@ -525,6 +525,9 @@ schema;schema_UNIT: | @@ -525,6 +525,9 @@ schema;schema_UNIT: | ||
525 | home: | 525 | home: |
526 | type: str | 526 | type: str |
527 | required: True | 527 | required: True |
528 | + duskelev: | ||
529 | + type: str | ||
530 | + required: True | ||
528 | horizon: | 531 | horizon: |
529 | type: map | 532 | type: map |
530 | required: True | 533 | required: True |
docker/docker-compose.yml
@@ -133,7 +133,7 @@ services: | @@ -133,7 +133,7 @@ services: | ||
133 | resources: | 133 | resources: |
134 | limits: | 134 | limits: |
135 | cpus: '1' | 135 | cpus: '1' |
136 | - memory: 8GB | 136 | + memory: 32GB |
137 | #pids: 1 | 137 | #pids: 1 |
138 | # create network to allow images to communicate with other images within the same network | 138 | # create network to allow images to communicate with other images within the same network |
139 | # networks: | 139 | # networks: |
src/core/pyros_django/majordome/agent/Agent.py
@@ -154,7 +154,8 @@ import config.old_config as config_old | @@ -154,7 +154,8 @@ import config.old_config as config_old | ||
154 | #from config import * | 154 | #from config import * |
155 | 155 | ||
156 | from majordome.models import AgentSurvey, AgentCmd, AgentLogs | 156 | from majordome.models import AgentSurvey, AgentCmd, AgentLogs |
157 | -from user_mgmt.models import Period, Quota | 157 | +from user_mgmt.models import Period |
158 | +from scp_mgmt.models import Quota | ||
158 | 159 | ||
159 | from vendor.guitastro.src.guitastro import Ephemeris | 160 | from vendor.guitastro.src.guitastro import Ephemeris |
160 | import pickle | 161 | import pickle |
@@ -3551,21 +3552,21 @@ class Agent: | @@ -3551,21 +3552,21 @@ class Agent: | ||
3551 | # --- Check if durations.pickle file exists | 3552 | # --- Check if durations.pickle file exists |
3552 | rootdir = self._oc['config'].fn.rootdir | 3553 | rootdir = self._oc['config'].fn.rootdir |
3553 | filename = os.path.join(rootdir, period_id, "durations.pickle") | 3554 | filename = os.path.join(rootdir, period_id, "durations.pickle") |
3554 | - self.dprint(f"Read {filename=}") | 3555 | + log.info(f"Read {filename=}") |
3555 | if os.path.exists(filename): | 3556 | if os.path.exists(filename): |
3556 | self._oc['config'].fn.fcontext = fcontext0 | 3557 | self._oc['config'].fn.fcontext = fcontext0 |
3557 | return pickle.load(open(filename, "wb")) | 3558 | return pickle.load(open(filename, "wb")) |
3558 | 3559 | ||
3559 | # --- Get the period limit dates jd1, jd2 | 3560 | # --- Get the period limit dates jd1, jd2 |
3560 | - self.dprint(f"{dir(operiod)=}") | 3561 | + log.info(f"{dir(operiod)=}") |
3561 | d = operiod.start_date.isoformat() | 3562 | d = operiod.start_date.isoformat() |
3562 | night_start = d[0:4]+d[5:7]+d[8:10] | 3563 | night_start = d[0:4]+d[5:7]+d[8:10] |
3563 | jd1, _ = self.config.fn.night2date(night_start) | 3564 | jd1, _ = self.config.fn.night2date(night_start) |
3564 | d = operiod.end_date.isoformat() | 3565 | d = operiod.end_date.isoformat() |
3565 | night_end = d[0:4]+d[5:7]+d[8:10] | 3566 | night_end = d[0:4]+d[5:7]+d[8:10] |
3566 | jd2, _ = self.config.fn.night2date(night_end) | 3567 | jd2, _ = self.config.fn.night2date(night_end) |
3567 | - self.dprint(f"{night_start=} {night_end=}") | ||
3568 | - self.dprint(f"{jd1=} {jd2=}") | 3568 | + log.info(f"{night_start=} {night_end=}") |
3569 | + log.info(f"{jd1=} {jd2=}") | ||
3569 | 3570 | ||
3570 | # --- Loop over dates of the period to create ephems | 3571 | # --- Loop over dates of the period to create ephems |
3571 | targets = ['sun', 'moon'] | 3572 | targets = ['sun', 'moon'] |
@@ -3576,10 +3577,11 @@ class Agent: | @@ -3576,10 +3577,11 @@ class Agent: | ||
3576 | d_cur = 0 | 3577 | d_cur = 0 |
3577 | d_total = 0 | 3578 | d_total = 0 |
3578 | night_info = {} | 3579 | night_info = {} |
3580 | + self._duskelev = self.config.getDuskElev() | ||
3579 | while jd < jd2: | 3581 | while jd < jd2: |
3580 | night = self._oc['config'].fn.date2night(jd) | 3582 | night = self._oc['config'].fn.date2night(jd) |
3581 | for target in targets: | 3583 | for target in targets: |
3582 | - self.dprint(f"{night=} {target=}") | 3584 | + log.info(f"{night=} {target=}") |
3583 | ephem = self.ephem_target2night(target, jd) | 3585 | ephem = self.ephem_target2night(target, jd) |
3584 | if target == "sun": | 3586 | if target == "sun": |
3585 | ks = np.where(ephem['alt'] < self._duskelev) | 3587 | ks = np.where(ephem['alt'] < self._duskelev) |
src/core/pyros_django/obs_config/obsconfig_class.py
@@ -1239,6 +1239,16 @@ class OBSConfig: | @@ -1239,6 +1239,16 @@ class OBSConfig: | ||
1239 | """ | 1239 | """ |
1240 | home = self.get_unit_by_name(self.unit_name).get("home") | 1240 | home = self.get_unit_by_name(self.unit_name).get("home") |
1241 | return home | 1241 | return home |
1242 | + | ||
1243 | + def getDuskElev(self)->float: | ||
1244 | + """ | ||
1245 | + Return duskelev of current unit | ||
1246 | + | ||
1247 | + Returns: | ||
1248 | + float: string reprensenting duskelev of unit | ||
1249 | + """ | ||
1250 | + duskelev = float(self.get_unit_by_name(self.unit_name).get("duskelev")) | ||
1251 | + return duskelev | ||
1242 | 1252 | ||
1243 | def get_agent_path_data_root(self, agent_name:str, computer_hostname=None) -> str: | 1253 | def get_agent_path_data_root(self, agent_name:str, computer_hostname=None) -> str: |
1244 | """ | 1254 | """ |
src/core/pyros_django/scp_mgmt/A_SCP_Manager.py
@@ -58,9 +58,8 @@ class A_SCP_Manager(Agent): | @@ -58,9 +58,8 @@ class A_SCP_Manager(Agent): | ||
58 | super().__init__() | 58 | super().__init__() |
59 | next_period = Period.objects.next_period() | 59 | next_period = Period.objects.next_period() |
60 | period = next_period | 60 | period = next_period |
61 | - self.pconfig = self._oc['pyros_config'] | ||
62 | - self._fn = self.config.fn | ||
63 | self.config = self._oc['config'] | 61 | self.config = self._oc['config'] |
62 | + self._fn = self.config.fn | ||
64 | self._fn.pathnaming("PyROS.seq.1") | 63 | self._fn.pathnaming("PyROS.seq.1") |
65 | 64 | ||
66 | # @override | 65 | # @override |
@@ -259,7 +258,7 @@ class A_SCP_Manager(Agent): | @@ -259,7 +258,7 @@ class A_SCP_Manager(Agent): | ||
259 | 258 | ||
260 | def set_quota_for_SP(self, id_period): | 259 | def set_quota_for_SP(self, id_period): |
261 | period = Period.objects.get(id=id_period) | 260 | period = Period.objects.get(id=id_period) |
262 | - for sp_period in SP_Period.objects.filter(period=period) | 261 | + for sp_period in SP_Period.objects.filter(period=period): |
263 | sp = sp_period.scientific_program | 262 | sp = sp_period.scientific_program |
264 | institute = sp.institute | 263 | institute = sp.institute |
265 | institute_quota = institute.quota | 264 | institute_quota = institute.quota |