a2p2 0.2.14__py3-none-any.whl → 0.7.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. a2p2/__main__.py +40 -1
  2. a2p2/chara/facility.py +54 -4
  3. a2p2/chara/gui.py +31 -5
  4. a2p2/client.py +158 -31
  5. a2p2/facility.py +14 -1
  6. a2p2/gui.py +46 -12
  7. a2p2/instrument.py +3 -0
  8. a2p2/jmmc/__init__.py +7 -0
  9. a2p2/jmmc/catalogs.py +129 -0
  10. a2p2/jmmc/generated_models.py +191 -0
  11. a2p2/jmmc/models.py +104 -0
  12. a2p2/jmmc/services.py +16 -0
  13. a2p2/jmmc/utils.py +130 -0
  14. a2p2/jmmc/webservices.py +48 -0
  15. a2p2/ob.py +98 -9
  16. a2p2/samp.py +20 -0
  17. a2p2/version.py +210 -131
  18. a2p2/vlti/conf/GRAVITY_ditTable.json +21 -19
  19. a2p2/vlti/conf/GRAVITY_rangeTable.json +200 -28
  20. a2p2/vlti/conf/MATISSE_rangeTable.json +58 -22
  21. a2p2/vlti/conf/PIONIER_ditTable.json +1 -1
  22. a2p2/vlti/conf/PIONIER_rangeTable.json +16 -18
  23. a2p2/vlti/facility.py +160 -43
  24. a2p2/vlti/gravity.py +243 -311
  25. a2p2/vlti/gui.py +165 -39
  26. a2p2/vlti/instrument.py +266 -49
  27. a2p2/vlti/matisse.py +61 -147
  28. a2p2/vlti/pionier.py +34 -157
  29. {a2p2-0.2.14.dist-info → a2p2-0.7.4.dist-info}/METADATA +34 -20
  30. a2p2-0.7.4.dist-info/RECORD +39 -0
  31. {a2p2-0.2.14.dist-info → a2p2-0.7.4.dist-info}/WHEEL +1 -1
  32. {a2p2-0.2.14.dist-info → a2p2-0.7.4.dist-info}/entry_points.txt +0 -1
  33. a2p2/vlti/confP104/GRAVITY_ditTable.json +0 -122
  34. a2p2/vlti/confP104/GRAVITY_rangeTable.json +0 -202
  35. a2p2/vlti/confP104/MATISSE_ditTable.json +0 -2
  36. a2p2/vlti/confP104/MATISSE_rangeTable.json +0 -202
  37. a2p2/vlti/confP104/PIONIER_ditTable.json +0 -77
  38. a2p2/vlti/confP104/PIONIER_rangeTable.json +0 -118
  39. a2p2/vlti/confP105/GRAVITY_ditTable.json +0 -37
  40. a2p2/vlti/confP105/GRAVITY_rangeTable.json +0 -42
  41. a2p2/vlti/confP105/MATISSE_ditTable.json +0 -2
  42. a2p2/vlti/confP105/MATISSE_rangeTable.json +0 -44
  43. a2p2/vlti/confP105/PIONIER_ditTable.json +0 -25
  44. a2p2/vlti/confP105/PIONIER_rangeTable.json +0 -38
  45. a2p2-0.2.14.dist-info/RECORD +0 -44
  46. {a2p2-0.2.14.dist-info → a2p2-0.7.4.dist-info}/LICENSE +0 -0
  47. {a2p2-0.2.14.dist-info → a2p2-0.7.4.dist-info}/top_level.txt +0 -0
a2p2/__main__.py CHANGED
@@ -2,7 +2,40 @@
2
2
  from __future__ import with_statement
3
3
 
4
4
  import traceback
5
+
5
6
  from argparse import ArgumentParser
7
+ from a2p2 import __release_notes__
8
+ from distutils.version import LooseVersion
9
+
10
+
11
+
12
+ def createMdReleaseNotes():
13
+ """
14
+ Present in a reverse ordered way the dictionnary version items.
15
+ """
16
+ txt = "# A2P2 release notes"
17
+ lvs = [LooseVersion(v) for v in __release_notes__]
18
+ for lv in sorted(lvs, reverse=True):
19
+ v=lv.vstring
20
+ txt += "\n## V " + v + " :"
21
+ keys = []
22
+ for k in sorted(__release_notes__[v]):
23
+ if not ("TODO" in k):
24
+ keys.append(k)
25
+ for k in sorted(__release_notes__[v]):
26
+ if "TODO" in k:
27
+ keys.append(k)
28
+
29
+ for e in keys:
30
+ infos = __release_notes__[v][e]
31
+ if infos:
32
+ txt += "\n### " + e + " : "
33
+ for i in infos:
34
+ txt += "\n- " + i
35
+ txt += "\n\n"
36
+ f=open("release-notes.md", "w")
37
+ f.write(txt)
38
+ print(f"{f.name} generated")
6
39
 
7
40
 
8
41
  def main():
@@ -14,17 +47,23 @@ def main():
14
47
  help='fake API to avoid remote connection (dev. only).')
15
48
  parser.add_argument('-v', '--verbose', action='store_true', help='Verbose')
16
49
  parser.add_argument('-c', '--createprefs', action='store_true', help='Create preferences file')
50
+ parser.add_argument('-r', '--releasenotes', action='store_true', help='Create md release notes file')
17
51
 
18
52
  args = parser.parse_args()
19
53
 
20
54
  from . import A2p2Client
21
55
 
56
+ if args.releasenotes:
57
+ createMdReleaseNotes()
58
+ exit()
59
+
22
60
  if args.createprefs:
23
61
  A2p2Client.createPreferencesFile()
24
62
  exit()
25
63
 
64
+
26
65
  try:
27
- with A2p2Client(args.fakeapi) as a2p2c:
66
+ with A2p2Client(args.fakeapi, args.verbose) as a2p2c:
28
67
  # if args.config:
29
68
  # print(a2p2c)
30
69
  # else:
a2p2/chara/facility.py CHANGED
@@ -4,19 +4,28 @@ __all__ = []
4
4
 
5
5
  from a2p2.chara.gui import CharaUI
6
6
  from a2p2.facility import Facility
7
+ import requests
8
+ import logging
9
+ import traceback
7
10
 
8
11
  HELPTEXT = "TODO update this HELP message in a2p2/chara/facility.py"
9
12
 
13
+ logger = logging.getLogger(__name__)
10
14
 
11
15
  class CharaFacility(Facility):
12
16
 
13
17
  def __init__(self, a2p2client):
14
18
  Facility.__init__(self, a2p2client, "CHARA", HELPTEXT)
15
19
  self.charaUI = CharaUI(self)
20
+ self.connected2OB2 = False
21
+ self.validQueueServer = None
16
22
 
17
23
  def processOB(self, ob):
24
+ if not ob:
25
+ return
26
+
18
27
  self.a2p2client.ui.addToLog(
19
- "Receive OB for '" + self.facilityName + "' interferometer")
28
+ "OB received for '" + self.facilityName + "' interferometer")
20
29
  # show ob dict for debug
21
30
  self.a2p2client.ui.addToLog(str(ob), False)
22
31
 
@@ -26,8 +35,49 @@ class CharaFacility(Facility):
26
35
  # give focus on last updated UI
27
36
  self.a2p2client.ui.showFacilityUI(self.charaUI)
28
37
 
38
+ def checkServer(self):
39
+ if self.validQueueServer:
40
+ # recheck ?
41
+ return True
42
+ else:
43
+ # search and test servers from preferences
44
+ queueServers=self.a2p2client.preferences.getCharaQueueServer()
45
+ msg=""
46
+ if queueServers :
47
+ for queueServer in queueServers:
48
+ logger.debug(f'Trying to send OB on queuserver : {queueServer}')
49
+ try:
50
+ c=requests.get(queueServer, timeout=3)
51
+ msg+=f"Connection succeeded on OB server : {c.json()}\n"
52
+ self.validQueueServer = queueServer
53
+ break
54
+ except:
55
+ msg+=f"Connection failed on {queueServer}\n"
56
+
57
+ self.a2p2client.ui.addToLog(msg)
58
+ self.charaUI.display(msg)
59
+
60
+ return self.validQueueServer
61
+
29
62
  def consumeOB(self, ob):
30
- # for the prototype: just delegate handling to the GUI
31
- # we could imagine to store obs in a list and recompute a sorted
32
- # summary report e.g.
63
+ if self.checkServer():
64
+ try:
65
+ r = requests.post(self.validQueueServer, json=ob.as_dict(), timeout=3)
66
+ msg = ""
67
+ msg+=f"OB sent to remote server queue : {r}"
68
+ self.connected2OB2 = True
69
+ self.a2p2client.ui.addToLog(msg)
70
+ self.charaUI.display(msg)
71
+ except:
72
+ print(traceback.format_exc())
73
+ msg=f"Can't send OB to the '{self.validQueueServer}' queue server, please relaunch it or try again for a new one."
74
+ self.validQueueServer = None
75
+ self.a2p2client.ui.addToLog(msg)
76
+ self.charaUI.display(msg)
77
+ else:
78
+ msg=f"Can't find any queue server, please launch it, edit your preferences or check your ssh port forwarding"
79
+
80
+ # display OB
33
81
  self.charaUI.displayOB(ob)
82
+
83
+
a2p2/chara/gui.py CHANGED
@@ -4,6 +4,7 @@ __all__ = []
4
4
 
5
5
  import sys
6
6
  import traceback
7
+ import logging
7
8
 
8
9
  from a2p2.gui import FacilityUI
9
10
 
@@ -17,6 +18,7 @@ else:
17
18
  # Constants
18
19
  _HR = "\n----------------------------------------------\n"
19
20
 
21
+ logger = logging.getLogger(__name__)
20
22
 
21
23
  class CharaUI(FacilityUI):
22
24
 
@@ -40,6 +42,10 @@ class CharaUI(FacilityUI):
40
42
  else:
41
43
  return None
42
44
 
45
+ def display(self, msg):
46
+ self.text.insert(END, msg)
47
+
48
+
43
49
  def displayOB(self, ob):
44
50
  try:
45
51
  buffer = self.extractReport(ob)
@@ -89,8 +95,8 @@ AO Flat Star:
89
95
  targets = {} # store ids for futur retrieval in schedule
90
96
  for oc in ob.observationConfiguration:
91
97
  targets[oc.id] = oc
92
- if "SCI" in oc.type:
93
- sciences.append(oc)
98
+ # if "SCI" in oc.type:
99
+ sciences.append(oc)
94
100
 
95
101
  # Retrieve cals from schedule
96
102
  cals = {}
@@ -107,13 +113,28 @@ AO Flat Star:
107
113
 
108
114
  for oc in sciences:
109
115
  sct = oc.SCTarget
116
+ extrainfos = self.get(sct, "EXTRA_INFORMATIONS")
110
117
  ftt = self.get(oc, "FTTarget")
111
118
  aot = self.get(oc, "AOTarget")
112
- buffer += oc.observationConstraints.LSTinterval + "\n"
113
- buffer += "Object:\n"
119
+
120
+ if self.get(oc,'observationConstraints'):
121
+ buffer += ", ".join(oc.observationConstraints.LSTinterval) + "\n"
122
+ else:
123
+ buffer += " NOT OBSERVABLE \n"
124
+ buffer += f"{oc.type} Object:\n"
114
125
  fluxes = ", ".join([e[0] + "=" + e[1]
115
126
  for e in ob.getFluxes(sct).items()])
116
- info = sct.SPECTYP + ", " + sct.PARALLAX
127
+ try:
128
+ info = sct.SPECTYP
129
+ except:
130
+ info = "no SPECTYP"
131
+ info+=", "
132
+ try:
133
+ info += sct.PARALLAX
134
+ except:
135
+ info += "no PARALLAX"
136
+
137
+
117
138
  buffer += sct.name + " (" + info + ") : " + fluxes + "\n"
118
139
  if ftt:
119
140
  buffer += "Fringe Finder:\n"
@@ -131,6 +152,11 @@ AO Flat Star:
131
152
  for cal in cals:
132
153
  buffer += "- " + cal + "\n"
133
154
 
155
+ # Display Extra_Informations if any
156
+ if extrainfos:
157
+ buffer += "Extra_infos:\n"
158
+ buffer += ", ".join([f"{field}={self.get(extrainfos,field)}" for field in extrainfos._fields])
159
+
134
160
  buffer += _HR
135
161
 
136
162
  return buffer
a2p2/client.py CHANGED
@@ -6,6 +6,7 @@ import time
6
6
  import traceback
7
7
  import os
8
8
  import configparser
9
+ import logging
9
10
 
10
11
  from a2p2 import __version__
11
12
  from a2p2.facility import FacilityManager
@@ -16,6 +17,21 @@ from a2p2.vlti.facility import VltiFacility
16
17
 
17
18
 
18
19
 
20
+ # prepare global logging
21
+ a2p2Rootlogger = logging.getLogger("a2p2")
22
+ a2p2Rootlogger.setLevel(logging.INFO)
23
+ # uncomment next two lines to log requests done by p2api as debug and maybe other ones...
24
+ #a2p2Rootlogger = logging.getLogger()
25
+ #a2p2Rootlogger.setLevel(logging.DEBUG)
26
+ console = logging.StreamHandler()
27
+ console.setLevel(logging.DEBUG)
28
+ consoleFormatter = logging.Formatter(
29
+ '%(levelname)s - %(name)s - %(asctime)s - %(filename)s:%(lineno)d - %(message)s')
30
+ console.setFormatter(consoleFormatter)
31
+ a2p2Rootlogger.addHandler(console)
32
+
33
+ logger = logging.getLogger(__name__)
34
+
19
35
 
20
36
  class A2p2Client():
21
37
  """Transmit your Aspro2 observation to remote Observatory scheduling database.
@@ -24,8 +40,7 @@ class A2p2Client():
24
40
  a2p2.run()
25
41
  ..."""
26
42
 
27
-
28
- def __init__(self, fakeAPI=False):
43
+ def __init__(self, fakeAPI=False, verbose=False):
29
44
  """Create the A2p2 client."""
30
45
 
31
46
  self.preferences = A2P2ClientPreferences()
@@ -35,17 +50,26 @@ class A2p2Client():
35
50
  self.apiName = "fakeAPI"
36
51
  self.fakeAPI = fakeAPI
37
52
 
53
+ if verbose:
54
+ a2p2Rootlogger.setLevel(logging.DEBUG)
55
+
38
56
  self.ui = MainWindow(self)
39
57
  # Instantiate the samp client and connect to the hub later
40
58
  self.a2p2SampClient = A2p2SampClient()
41
59
  self.facilityManager = FacilityManager(self)
42
60
 
43
61
  if self.preferences.exists():
44
- pass
62
+ A2P2ClientPreferences.updatePreferencesFile()
63
+ self.ui.addToLog(
64
+ f"Using preference from '{A2P2ClientPreferences.getPreferencesFileName()}'.\n")
45
65
  else:
46
- self.ui.addToLog("No preference file found, please create one so your data persists (launch program with -c option).\n\n")
66
+ self.ui.addToLog(
67
+ "No preference file found, please create one so your data persists (launch program with -c option).\n")
68
+
69
+ self.ui.addToLog("Please often update ( pip install -U [--user] a2p2 ) and don't hesitate to send any feedback or issues!\n\n")
47
70
 
48
- self.errors=[]
71
+
72
+ self.errors = []
49
73
 
50
74
  pass
51
75
 
@@ -101,18 +125,20 @@ class A2p2Client():
101
125
  # bool of status change
102
126
  flag = [0]
103
127
 
128
+ logger.info("Running client ...")
104
129
 
105
130
  # handle autologin
106
131
  if self.preferences.getP2AutoLoginBoolean():
107
- self.ui.addToLog("\nAutologin into P2 API please wait...\n")
132
+ logger.debug("Autologin using '%s' file" %
133
+ A2P2ClientPreferences.getPreferencesFileName())
108
134
  self.ui.loop()
109
- vltifacility = self.facilityManager.facilities.get(VltiFacility.getName())
135
+ vltifacility = self.facilityManager.facilities.get(
136
+ VltiFacility.getName())
110
137
  vltifacility.autologin()
111
138
 
112
-
113
139
  # We now run the loop to wait for the message in a try/finally block so that if
114
140
  # the program is interrupted e.g. by control-C, the client terminates
115
- # gracefully.
141
+ # gracefully. ( but sometimes fails inside tkinter/__init__.py CallWrapper/__call__() )
116
142
 
117
143
  # We test every 1s to see if the hub has sent a message
118
144
  delay = 0.1
@@ -125,8 +151,14 @@ class A2p2Client():
125
151
  loop_cnt += 1
126
152
  time.sleep(delay)
127
153
 
154
+ # if loop_cnt % each == 0:
155
+ # logger.debug(f"loop {loop_cnt}")
156
+
128
157
  self.ui.loop()
129
158
 
159
+ # process any stacked OBs
160
+ self.facilityManager.processOB()
161
+
130
162
  if not self.a2p2SampClient.is_connected() and loop_cnt % each == 0:
131
163
  try:
132
164
  self.a2p2SampClient.connect()
@@ -142,11 +174,21 @@ class A2p2Client():
142
174
 
143
175
  if self.a2p2SampClient.has_message():
144
176
  try:
145
- ob = OB(self.a2p2SampClient.get_ob_url())
146
- self.facilityManager.processOB(ob)
177
+ if self.a2p2SampClient.has_ob_message():
178
+ ob = OB(self.a2p2SampClient.get_ob_url())
179
+ self.facilityManager.processOB(ob)
147
180
  except:
148
181
  self.ui.addToLog(
149
- "Exception during ob creation: " + traceback.format_exc(), False)
182
+ "Exception during a2p2 ob creation: " + traceback.format_exc(), False)
183
+ self.ui.addToLog("Can't process last OB")
184
+
185
+ try:
186
+ if self.a2p2SampClient.has_model_message():
187
+ m = self.a2p2SampClient.get_model()
188
+ self.showModel(m)
189
+ except:
190
+ self.ui.addToLog(
191
+ "Exception during a2p2 ob creation: " + traceback.format_exc(), False)
150
192
  self.ui.addToLog("Can't process last OB")
151
193
 
152
194
  # always clear previous received message
@@ -156,16 +198,27 @@ class A2p2Client():
156
198
  loop_cnt = -1
157
199
  except KeyboardInterrupt:
158
200
  loop_cnt = -1
201
+ print("\nDisconnecting SAMP ...")
202
+ self.a2p2SampClient.disconnect()
203
+ print("Bye!")
204
+
159
205
 
160
206
  def createPreferencesFile():
161
207
  A2P2ClientPreferences.createPreferencesFile()
162
208
 
209
+
210
+ def showModel(self, xmlmodel):
211
+ from a2p2.jmmc.models import modelsFromXml
212
+ self.ui.addToLog("Received star model")
213
+ self.ui.addToLog(modelsFromXml(xmlmodel))
214
+
215
+
163
216
  class A2P2ClientPreferences():
164
217
  # define application name
165
218
  appname = "a2p2"
166
219
 
167
220
  def __init__(self):
168
- self._config = A2P2ClientPreferences.getPreferences()
221
+ self._config = A2P2ClientPreferences.getPreferences()
169
222
  pass
170
223
 
171
224
  def exists(self):
@@ -176,36 +229,84 @@ class A2P2ClientPreferences():
176
229
 
177
230
  def getPreferences():
178
231
  preferences_file = A2P2ClientPreferences.getPreferencesFileName()
179
- config = configparser.ConfigParser()
232
+ config = configparser.ConfigParser(allow_no_value=True)
180
233
  config.read(preferences_file)
181
234
  return config
182
235
 
183
236
  def getPreferencesFileName():
184
237
  from appdirs import user_config_dir
185
- preferences_file = os.path.join(user_config_dir(A2P2ClientPreferences.appname), "prefs.ini")
238
+ preferences_file = os.path.join(user_config_dir(
239
+ A2P2ClientPreferences.appname), "prefs.ini")
186
240
  return preferences_file
241
+ def updatePreferencesFile():
242
+ return
243
+ # TODO
244
+ # we suppose the file exists
245
+ filename = A2P2ClientPreferences.getPreferencesFileName()
246
+ buffer=""
247
+ for line in open(filename):
248
+ buffer+=line+"\n"
249
+ print (buffer)
187
250
 
188
251
  def createPreferencesFile():
189
- filename=A2P2ClientPreferences.getPreferencesFileName()
190
-
252
+ filename = A2P2ClientPreferences.getPreferencesFileName()
191
253
  if os.path.exists(filename):
192
- print("%s already exists. Nothing done"%filename)
254
+ print(f"{filename} already exists. Nothing done")
255
+ p=A2P2ClientPreferences()
256
+ versionInPref=p.getA2P2Version()
257
+ if __version__ != versionInPref:
258
+ print(f"HINT: You may try to backup this file (V{versionInPref}) and merge with a new generated one for V{__version__}.")
193
259
  else:
194
- config = configparser.ConfigParser()
260
+ import getpass
261
+
262
+ config = configparser.ConfigParser(allow_no_value=True)
195
263
  #config['DEFAULT'] = {'_noprefyet': '42'}
264
+
265
+ config['a2p2'] = {}
266
+ s = config['a2p2']
267
+ s['# A2P2 SECTION'] = ""
268
+ s['# = > please do not modify next properties <'] = ""
269
+ s['version'] = __version__
270
+
271
+
272
+ config['jmmc'] = {}
273
+ s = config['jmmc']
274
+ s['# JMMC SECTION'] = ""
275
+ s['# = > please uncomment and update next properties to make it active <'] = ""
276
+ s['#login'] = "my.email@my.lab"
277
+ s['#password'] = "12345zZ"
278
+
279
+ config['chara'] = {}
280
+ s = config['chara']
281
+ s['# CHARA SECTION'] = ""
282
+ s['# = > please uncomment and update next properties to make it active <'] = ""
283
+ s['# = > queueserver may be uncommented to forward OB to a remote server instead <'] = ""
284
+ s['#queueserver'] = 'http://192.168.3.153:2468/test,http://localhost:2468/test'
285
+
196
286
  config['p2'] = {}
197
- import getpass
198
- config['p2']['# = > please uncomment and update next properties to make it active <']=""
199
- config['p2']['#username'] = getpass.getuser()
200
- config['p2']['#password'] = "12345zZ"
201
- config['p2']['#user_comment_name'] = "changed it if your local USER name is not fine"
202
- config['p2']['#autologin'] = "yes"
287
+ s=config['p2']
288
+ s['# ESO P2 SECTION'] = ""
289
+ s['# = > please uncomment and update next properties to make it active <'] = ""
290
+ s['#username'] = getpass.getuser()
291
+ s['#password'] = "12345zZ"
292
+ s['#autologin'] = "yes"
293
+ s['# = > please change next properties to change the name recorded in the OB comments <'] = ""
294
+ s['user_comment_name'] = f"{getpass.getuser()}"
295
+
296
+ config['p2.iss.vltitype'] = {}
297
+ s=config['p2.iss.vltitype']
298
+ s['# = > please uncomment the default values to add for ISS.VLTITYPE <'] = ""
299
+ s['# = > all supported will be added for any VLTI instrument if info is not provided by Aspro2 <'] = None
300
+ s['#snapshot'] = None
301
+ s['#imaging'] = None
302
+ s['#time-series'] = None
303
+ s['#astrometry'] = None
203
304
 
204
305
  os.makedirs(os.path.dirname(filename), exist_ok=True)
205
306
  with open(filename, 'w+') as configfile:
206
307
  config.write(configfile)
207
308
 
208
- print("%s template created. Please adjust."%filename)
309
+ print("'%s' template file created to store preferences. Please check and adjust it's content." % filename)
209
310
 
210
311
  def getConfig(self, section, key, default=None):
211
312
  try:
@@ -213,19 +314,44 @@ class A2P2ClientPreferences():
213
314
  except:
214
315
  return default
215
316
 
317
+ def getConfigKeys(self, section, default=None):
318
+ try:
319
+ return list(self._config[section].keys())
320
+ except:
321
+ return default
322
+
323
+
216
324
  def getConfigBoolean(self, section, key, default=None):
217
325
  try:
218
- return self._config.getboolean(section,key)
326
+ return self._config.getboolean(section, key)
219
327
  except:
220
328
  return default
221
329
 
330
+ # Retrieve A2P2 prefs
331
+ def getA2P2Version(self):
332
+ return self.getConfig("a2p2", "version", 'missing')
333
+
334
+ # Retrieve JMMC prefs
335
+ def getJmmcLogin(self):
336
+ return self.getConfig("jmmc", "login", None)
222
337
 
223
- # retrieve P2 username in config or use default demo account
338
+ def getJmmcPassword(self):
339
+ return self.getConfig("jmmc", "password", None)
340
+
341
+ # Retrieve CHARA prefs
342
+ def getCharaQueueServer(self):
343
+ s = self.getConfig("chara", "queueserver", None)
344
+ if s:
345
+ return s.split(",")
346
+
347
+
348
+ # Retrieve P2 prefs
224
349
  def getP2Username(self):
225
- return self.getConfig("p2","username", '52052')
350
+ """ Get P2 username in config or use default demo account """
351
+ return self.getConfig("p2", "username", '52052')
226
352
 
227
- # retrieve P2 password in config or use default demo account
228
353
  def getP2Password(self):
354
+ """Get P2 password in config or use default demo account"""
229
355
  return self.getConfig("p2", "password", 'tutorial')
230
356
 
231
357
  def getP2UserCommentName(self):
@@ -233,5 +359,6 @@ class A2P2ClientPreferences():
233
359
  return self.getConfig("p2", "user_comment_name", getpass.getuser())
234
360
 
235
361
  def getP2AutoLoginBoolean(self):
236
- return self.getConfigBoolean("p2", "autologin", False)
362
+ return self.getConfigBoolean("p2", "autologin", False)
363
+
237
364
 
a2p2/facility.py CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  __all__ = []
4
4
 
5
+ import logging
6
+
7
+ logger = logging.getLogger(__name__)
5
8
 
6
9
  class FacilityManager():
7
10
  """
@@ -35,7 +38,17 @@ class FacilityManager():
35
38
 
36
39
  return " | ".join(status)
37
40
 
38
- def processOB(self, ob):
41
+ def processOB(self, ob=None):
42
+
43
+ # handled queued obs if ob is null
44
+ # TODO add a new method in the futur
45
+ if not ob:
46
+ for f in self.facilities.values():
47
+ f.processOB(ob)
48
+ return
49
+
50
+ # else handle given ob
51
+
39
52
  """ Test instrument on facility that registerInstrument() before OB forward for specialized handling."""
40
53
  interferometer = ob.interferometerConfiguration.name
41
54
  insname = ob.instrumentConfiguration.name