p2api 1.0.9__tar.gz → 1.0.11__tar.gz

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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: p2api
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary: Binding for the ESO phase 2 programmatic API
5
5
  Project-URL: Homepage, https://www.eso.org/copdemo/apidoc/index.html
6
6
  Author-email: Thomas Bierwirth <thomas.bierwirth@eso.org>, John Pritchard <john.pritchard@eso.org>
@@ -0,0 +1 @@
1
+ __version__ = "1.0.11"
@@ -170,7 +170,7 @@ class ApiConnection(object):
170
170
  raise P2Error(500, 'POST', kwargs['url'], 'Invalid URL')
171
171
  self.apiUrl = API_URL[environment]
172
172
  self.loginUrl = LOGIN_URL[environment]
173
- self.p2fc_url = P2FC_URL[param_values['environment']]
173
+ self.p2fc_url = P2FC_URL[environment]
174
174
  self.access_token = kwargs['access_token']
175
175
  self.session = self.requests_retry_session()
176
176
  else :
@@ -211,10 +211,13 @@ def oneOB( api, obId ) :
211
211
  c_GAIA_im_noise=options.c_GAIA_im_noise,
212
212
  )
213
213
  oneOB_edt=datetime.datetime.now()
214
- logging.info("Finding chart for OBid = %d, OBname = '%s' @ %s done in %s." % (obId, OB['name'], OB['instrument'], str(oneOB_edt-oneOB_sdt)))
214
+ logging.info(
215
+ "Finding chart for OBid = %d, OBname = '%s' @ %s done in %s."
216
+ % (obId, OB['name'], OB['instrument'], str(oneOB_edt-oneOB_sdt))
217
+ )
215
218
  if data is not None :
216
219
  try :
217
- jwarn=json.loads(r.content.decode('utf-8'))
220
+ jwarn=json.loads(data.content.decode('utf-8'))
218
221
  if 'warnings' in jwarn.keys() :
219
222
  logging.warning(jwarn['warnings'])
220
223
  except :
@@ -8,7 +8,7 @@ import getpass
8
8
  import keyring
9
9
  import re
10
10
 
11
- from p2api.utils.eso_period import *
11
+ #from p2api.utils.eso_period import *
12
12
 
13
13
  try:
14
14
  import astropy.units as u
@@ -78,7 +78,6 @@ def ESO_period_start_end_datetimes(P):
78
78
  y2=1967+(P+2)//2
79
79
  md2=ESO_period_first_last_dates[P%2][1]
80
80
  return ["{}{}".format(y1,md1),"{y2}{md2}.format(y2,md2)"]
81
- '''
82
81
  # ---------------------------------------------------------------------------------------
83
82
  def ESO_period_start_end_dates(P):
84
83
  return [
@@ -92,6 +91,7 @@ def ESO_period_start_end_datetimes(P):
92
91
  ESO_period_datetime_end(P),
93
92
  ]
94
93
  # ---------------------------------------------------------------------------------------
94
+ '''
95
95
  def get_attrs(klass):
96
96
  return [k for k in klass.__dict__.keys()
97
97
  if not k.startswith('__')
@@ -106,7 +106,8 @@ source: https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.python/bfb
106
106
  usage: parser = OptionParser(description=help_text, formatter=IndentedHelpFormatterWithNL())
107
107
  '''
108
108
 
109
- from optparse import OptionParser, IndentedHelpFormatter, textwrap
109
+ from optparse import IndentedHelpFormatter
110
+ import textwrap
110
111
 
111
112
  class IndentedHelpFormatterWithNL(IndentedHelpFormatter):
112
113
  def format_description(self, description):
@@ -36,14 +36,11 @@ classifiers = [
36
36
  "Programming Language :: Python :: 3.12",
37
37
  ]
38
38
  dependencies = [
39
- #"astroplan",
40
- #"astropy",
41
39
  "keyring",
42
40
  "requests",
43
41
  ]
44
42
 
45
43
  [project.scripts]
46
- #p2api_add_absolute_time_intervals = "p2api.utils.add_absolute_time_intervals:main"
47
44
  p2api_generate_finding_charts = "p2api.utils.generate_finding_charts:main"
48
45
 
49
46
  [project.urls]
@@ -1 +0,0 @@
1
- __version__ = "1.0.9"
@@ -1,476 +0,0 @@
1
- #! /usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- # $Id: generate_finding_charts.py 267033 2021-09-16 11:08:57Z jpritcha $
5
- from __future__ import print_function
6
-
7
- _VERSION_ = "$Revision: 267033 $"
8
- try:
9
- from ..p2api import __version__
10
- except:
11
- from p2api.__about__ import __version__
12
- _VERSION_ = __version__
13
-
14
- import sys # interaction with Python interpreter
15
- from optparse import OptionParser # for parsing command line arguments
16
- from optparse import OptionGroup
17
-
18
- import logging
19
-
20
- import keyring
21
- import datetime
22
- import re
23
-
24
- import p2api
25
- import p2api.utils.p2api_utils as p2api_utils
26
-
27
- from astropy.time import Time
28
- import numpy as np
29
- from astroplan import Observer
30
- import astropy.units as u
31
-
32
- ################################################################################
33
- default_eso_period=p2api_utils.current_ESO_period()+1
34
- min_ATI_length=1.*u.hr
35
- ################################################################################
36
- class get_options:
37
- "get command line options"
38
-
39
- def __init__(self, vers="0.0"):
40
- # define options and arguments
41
- parser = OptionParser(version="%prog "+vers, formatter=p2api_utils.IndentedHelpFormatterWithNL())
42
-
43
- group = OptionGroup(parser, "Input OB(s)")
44
- group.add_option(
45
- "-i", "--ids",
46
- dest="ids",
47
- help="""\
48
- List of run, container, folder, and/or OB IDs. \
49
- Note that the ATCs will be applied to all OBs recursively when a \
50
- run, container or folder is specified.
51
- [required]\
52
- """,
53
- default=None
54
- )
55
- parser.add_option_group(group)
56
-
57
- group = OptionGroup(parser, "Specify the Absolute Time Intervals explicity.")
58
- group.add_option(
59
- "--ATCs", dest="ATCs",
60
- help="""\
61
- Underscore separated list of comma separated Absolute Time Constraints \
62
- e.g. yyyy-mm-ddThh:mm,yyyy-mm-ddThh:mm_yyyy-mm-ddThh:mm,yyyy-mm-ddThh:mm{_...}
63
- [optional]\
64
- """,
65
- default=None
66
- )
67
- group.add_option("-f", "--file", dest="file", help="A file with one ATC per line [optional]", default=None)
68
- parser.add_option_group(group)
69
-
70
- group = OptionGroup(parser, "Specify the Absolute Time Intervals using an orbital ephemeris. This functionality is EXPERIMENTAL, please check carefully!!!")
71
- group.add_option("-E", "--ephem", dest="ephem", metavar="T0,PERIOD", help="Comma separated list of orbital T0[JD] and period[days] [optional]", default=None)
72
- group.add_option(
73
- "--phase_intervals",
74
- dest="phase_intervals",
75
- help="""\
76
- Comma separated list of phase intervals e.g. 0.1-0.2,0.305-0.375 [optional].
77
- Remember that ATCs specify the intervals during which the OBs must be started.
78
- This code however interprets the phase intervals as the intervals during which the OB must start AND finish. \
79
- Therefore the ending phase intervals of the ATCs that will be added to the OBs will always be \
80
- less than the phase intervals specified.\
81
- """,
82
- default=None
83
- )
84
- group.add_option("--phase_target", dest="phase_target", help="Comma separated list of target phase, start_before [mins], min_start_before [mins] e.g. 0.01,120,30 [optional]", default=None)
85
- group.add_option("--periods", dest="periods", help="Comma separated list of periods, default={} [optional]".format(default_eso_period), default=str(default_eso_period))
86
- parser.add_option_group(group)
87
-
88
- group = OptionGroup(parser, "Do NOT check ATCs for experimental methods.")
89
- group.add_option("--NO_checkATCs", dest="NO_checkATCs", help="Do NOT check ATCs for experimental methods.", action="store_true", default=False)
90
- parser.add_option_group(group)
91
-
92
- group = OptionGroup(parser, "p2 server selection, options and password management")
93
- group.add_option("--env", dest="env", help="Use the %s environment [optional], default = production" %("|".join(p2api.API_URL.keys())), default='production')
94
- group.add_option("-u", "--user", dest="user", metavar="USER", help="the User Portal account of the user to use, e.g. ASMITHSONIAN [required for production (not required for demo)]", default=None)
95
- group.add_option("-S", "--PWstore", dest="pwstore", metavar="PWSTORE", help="Store the password in the keyring, default=False", action="store_true", default=False)
96
- group.add_option("-R", "--PWreenter", dest="pwreenter", metavar="PWREENTER", help="Reenter the password, thus overriding any PW in the keyring, default=False", action="store_true", default=False)
97
- group.add_option("-Z", "--PWremove", dest="pwremove", metavar="PWREMOVE", help="Remove any password from the keyring, default=False", action="store_true", default=False)
98
- parser.add_option_group(group)
99
-
100
- group = OptionGroup(parser, "Verbosity...",
101
- "All optional")
102
- group.add_option("-n", "--dryRun", dest="dryrun", help="Do everything but make any changes to tickets [optional]", action="store_true", default=False)
103
- group.add_option("-D", "--debug", dest="debug", help="Write out debugging info [optional]", action="store_true", default=False)
104
- #group.add_option("-v", "--verbose", dest="vbose", help="Write out verbose info [optional]", action="store_true", default=False)
105
- group.add_option("-q", "--quiet", dest="quiet", help="Write out minimal info [optional]", action="store_true", default=False)
106
- parser.add_option_group(group)
107
-
108
- # parse arguments
109
- (options, args) = parser.parse_args()
110
-
111
- if options.ids is None or (
112
- (
113
- options.ATCs is None
114
- and
115
- options.file is None
116
- and
117
- (
118
- options.ephem is None
119
- or
120
- options.periods is None
121
- or
122
- options.phase_intervals is None
123
- )
124
- and
125
- (
126
- options.ephem is None
127
- or
128
- options.periods is None
129
- or
130
- options.phase_target is None
131
- )
132
- )
133
- ) :
134
- parser.print_help()
135
- sys.exit(2)
136
-
137
- self.ids = options.ids
138
- self.periods = options.periods
139
- self.ATCs = options.ATCs
140
- self.file = options.file
141
- self.ephem = options.ephem
142
- self.phase_intervals = options.phase_intervals
143
- self.phase_target = options.phase_target
144
-
145
- self.NO_checkATCs = options.NO_checkATCs
146
-
147
- self.user = options.user
148
- self.env = options.env
149
- self.pwstore = options.pwstore
150
- self.pwreenter = options.pwreenter
151
- self.pwremove = options.pwremove
152
-
153
- self.debug = options.debug
154
- self.dryrun = options.dryrun
155
- self.quiet = options.quiet
156
-
157
- logFMT = "%(asctime)s %(module)15s[%(process)5d] [%(levelname)s] %(message)s"
158
- logLVL=logging.INFO
159
- if options.debug:
160
- logLVL=logging.DEBUG
161
- if options.quiet:
162
- logLVL=logging.WARN
163
- logging.basicConfig(level=logLVL, format=logFMT)
164
-
165
- options = get_options(_VERSION_)
166
-
167
- # ------------------------------------------------------------------------------
168
- def get_ob_ATCs(telescope=None, ob_info=None, run_info=None) :
169
- ob_ATCs=[]
170
- ATCs=None
171
- check_ATCs=False
172
- if options.ATCs is not None :
173
- ATCs=[
174
- [p2api_utils.decode_datetime(x.split(',')[0]),p2api_utils.decode_datetime(x.split(',')[1])]
175
- for x in options.ATCs.split('_')
176
- ]
177
-
178
- elif options.file is not None :
179
- with open(options.file) as file:
180
- lines = file.readlines()
181
- lines = [line.rstrip().lstrip().split(',') for line in lines]
182
- ATCs=[
183
- [
184
- p2api_utils.decode_datetime(x[0])+datetime.timedelta(seconds=30), # rounding to 1min
185
- p2api_utils.decode_datetime(x[1])+datetime.timedelta(seconds=30), # rounding to 1min
186
- ] for x in lines
187
- ]
188
-
189
- elif options.ephem is not None :
190
- ob_exec_time=ob_info['executionTime']
191
- T0,P=(float(x) for x in options.ephem.split(','))
192
- periods=[
193
- item for sublist in
194
- [[y for y in range(int(x.split('-')[0]),int(x.split('-')[-1])+1)] for x in options.periods.split(',')]
195
- for item in sublist
196
- ]
197
- periods.sort()
198
- period_range=[periods[0],]
199
- period_ranges=[]
200
- _pp=periods[0]
201
- sf_jds=[]
202
- for _p in periods[1:] :
203
- if _p > _pp+1 :
204
- period_range+=[_pp,]
205
- sf_jd=Time([p2api_utils.ESO_period_start_end_datetimes(ESO_P) for ESO_P in period_range]).jd
206
- sf_jds+=[[sf_jd[0][0],sf_jd[1][1]],]
207
- period_ranges+=[period_range,]
208
- period_range=[_p,]
209
- _pp=_p
210
- period_range+=[_pp,]
211
- sf_jd=Time([p2api_utils.ESO_period_start_end_datetimes(ESO_P) for ESO_P in period_range]).jd
212
- sf_jds+=[[sf_jd[0][0],sf_jd[1][1]],]
213
- period_ranges+=[period_range,]
214
-
215
- post_ob_exec_time=0.
216
- if options.phase_intervals is not None :
217
- phase_intervals=[[float(y) for y in x.split('-')] for x in options.phase_intervals.split(',')]
218
- min_start_before=0.
219
- elif options.phase_target is not None :
220
- phase_target,start_before,min_start_before=(float(x) for x in options.phase_target.split(','))
221
- phase_intervals=[[phase_target-start_before/P/24./60.,phase_target],]
222
- post_ob_exec_time=ob_exec_time
223
- ob_exec_time=0.
224
- else :
225
- logging.error('No means to calculate phase intervals specified.')
226
-
227
- checked_phase_intervals=[]
228
- for p_int in phase_intervals :
229
- if p_int[1] < p_int[0] :
230
- p_int[0]=p_int[0]-1.
231
- p_int_in_sec=(p_int[1]-p_int[0])*P*24.*60.*60.
232
- if (
233
- ob_exec_time < p_int_in_sec
234
- and
235
- p_int_in_sec > min_ATI_length.to_value(u.second)
236
- ) :
237
- checked_phase_intervals+=[p_int,]
238
- else :
239
- if ob_exec_time < p_int_in_sec :
240
- logging.warning(
241
- 'Phase interval {}--{} == {:3.1f}sec is too short to start and finish this OB with execution time of {}secs.'.format(
242
- p_int[0],
243
- p_int[1],
244
- p_int_in_sec,
245
- ob_exec_time,
246
- )
247
- )
248
- if p_int_in_sec > min_ATI_length.to_value(u.second) :
249
- logging.warning(
250
- 'Phase interval {}--{} == {:3.1f}sec is shorter than the minimum ATI length time of {}secs.'.format(
251
- p_int[0],
252
- p_int[1],
253
- p_int_in_sec,
254
- min_ATI_length.to_value(u.second),
255
- )
256
- )
257
-
258
- sf_ints=[]
259
- for sf_jd in sf_jds :
260
- orbits=(np.array(sf_jd)-T0)//P
261
- for o in range(int(orbits[0])-1,int(orbits[1])+1) :
262
- for p_int in checked_phase_intervals :
263
- sf_int=[
264
- T0+(o+p_int[0])*P,
265
- T0+(o+p_int[1])*P-ob_exec_time/24./60./60.,
266
- ]
267
- if (
268
- ( sf_int[0] > sf_jd[0] and sf_int[0] < sf_jd[1] )
269
- or
270
- ( sf_int[1] > sf_jd[0] and sf_int[1] < sf_jd[1] )
271
- ) :
272
- # Interval is within the time range of the specified period(s)...
273
- original_sf_int=sf_int
274
- int_spans_nighttime=True
275
- if sf_int[1] - sf_int[0] < 1. :
276
- sssr=[]
277
- # Check that some part of the interval occurs during nighttime...
278
- int_spans_nighttime=False
279
- for which in ['previous','next',] :
280
- sun_set_time=telescope.sun_set_time(Time(sf_int[0], format='jd'), which=which)
281
- if isinstance(sun_set_time.value,np.float64) :
282
- sun_rise_time=telescope.sun_rise_time(sun_set_time, which='next')
283
- sssr+=[[sun_set_time,sun_rise_time],]
284
- if (
285
- (sf_int[0] > sun_set_time.jd and sf_int[0] < sun_rise_time.jd-ob_exec_time/24./60./60. )
286
- or
287
- (sf_int[1] > sun_set_time.jd and sf_int[1] < sun_rise_time.jd-ob_exec_time/24./60./60. )
288
- or
289
- (sf_int[0] < sun_set_time.jd and sf_int[1] > sun_rise_time.jd-ob_exec_time/24./60./60. )
290
- ) :
291
- sf_int=[
292
- np.max([sf_int[0],sun_set_time.jd]),
293
- np.min([sf_int[1],sun_rise_time.jd-ob_exec_time/24./60./60.,sun_rise_time.jd-post_ob_exec_time/24./60./60.]),
294
- ]
295
- if sf_int[1] > sf_int[0]+min_start_before/24./60. :
296
- int_spans_nighttime=True
297
- break
298
- else :
299
- logging.error(f"telescope.sun_set_time(Time({sf_int[0]}, format='jd'), which={which}) did not return np.float64 ")
300
- if (
301
- int_spans_nighttime
302
- and
303
- ((sf_int[1]-sf_int[0])*24*60.*60. > ob_exec_time)
304
- and
305
- (sf_int[1]-sf_int[0])*24*60.*60. > min_ATI_length.to_value(u.second)
306
- ) :
307
- sf_ints+=[sf_int,]
308
- else :
309
- if not int_spans_nighttime :
310
- logging.debug(
311
- 'Interval does not span any part of the night, original interval = {}, SSSR of previous and next nights {}--{} and {}--{}'.format(
312
- original_sf_int,
313
- sssr[0][0].jd,
314
- sssr[0][1].jd,
315
- sssr[1][0].jd,
316
- sssr[1][1].jd,
317
- )
318
- )
319
- if ((sf_int[1]-sf_int[0])*24*60.*60. < ob_exec_time) :
320
- logging.debug(
321
- 'Checked Interval shorter [{:3.1f}sec] than OB execution time [{:3.1f}sec], original interval = {}, checked interval = {}'.format(
322
- (sf_int[1]-sf_int[0])*24*60.*60.,
323
- ob_exec_time,
324
- original_sf_int,
325
- sf_int,
326
- )
327
- )
328
- if ((sf_int[1]-sf_int[0])*24*60.*60. < min_ATI_length.to_value(u.second)) :
329
- logging.debug(
330
- 'Checked Interval shorter [{:3.1f}sec] than minimum ATI length time [{:3.1f}sec], original interval = {}, checked interval = {}'.format(
331
- (sf_int[1]-sf_int[0])*24*60.*60.,
332
- min_ATI_length.to_value(u.second),
333
- original_sf_int,
334
- sf_int,
335
- )
336
- )
337
- pass
338
- ATCs=[Time(sf_int, format='jd') for sf_int in sf_ints]
339
- check_ATCs=True
340
- else :
341
- raise "Don't know how to compute Absolute Time Constraints."
342
-
343
- ob_ATCs=[]
344
- for i,ATC in enumerate(ATCs) :
345
- t=Time(ATC)
346
- t.format = 'isot'
347
- t.out_subfmt = 'date_hm'
348
- ob_ATCs+=[{
349
- 'from': t[0].isot,
350
- 'to': t[1].isot,
351
- },]
352
- if check_ATCs :
353
- phase_range=''
354
- if options.ephem is not None :
355
- phase_range=" [Phases: {:5.3f} -- {:5.3f}]".format(
356
- (((t[0]-Time(T0,format='jd'))/P).to_value(u.day)%1),
357
- (((t[1]-Time(T0,format='jd'))/P).to_value(u.day)%1),
358
- )
359
- print("{:3d} {} -- {} [OB_exectime={}, Int.duration={}]{}".format(
360
- i+1,
361
- ob_ATCs[-1]['from'],
362
- ob_ATCs[-1]['to'],
363
- datetime.timedelta(seconds=ob_exec_time),
364
- ((t[1]-t[0]).to_datetime()),
365
- phase_range,
366
- ))
367
- if check_ATCs :
368
- '''
369
- logging.warning("****************************************************************************************")
370
- logging.warning("****************************************************************************************")
371
- logging.warning("****************************************************************************************")
372
- logging.warning("Intervals via Orbital Ephemeris functionality is EXPERIMENTAL")
373
- logging.warning("Please check the above intervals carefully and only continue if you are sure they are what YOU require.")
374
- logging.warning("YOU, and YOU ALONE are responsible for the accuracy of these inetervals.")
375
- '''
376
- print("****************************************************************************************")
377
- print("****************************************************************************************")
378
- print("****************************************************************************************")
379
- print("Intervals via Orbital Ephemeris functionality is EXPERIMENTAL")
380
- print("Please check the above intervals carefully and only continue if you are sure they are what YOU require.")
381
- print("Remember that ATCs specify the intervals during which the OBs must be started.")
382
- print("While this code interprets the phase intervals as the intervals during which the OB must start AND finish.")
383
- print("Therefore the ending phase intervals of the ATCs listed above will always be")
384
- print("less than the phase intervals specified.")
385
- print("Ultimately YOU, and YOU ALONE, are responsible for the accuracy of these intervals.")
386
- if not options.NO_checkATCs :
387
- yorn = input("Continue [y/N] ")
388
- if yorn.lower() not in ['y',] :
389
- print("Please contact ESO User Support via a ticket at https://support.eso.org/tickets")
390
- print("to report/discuss the errors/problems in the above calculations.")
391
- print("Please include in the description the EXACT command line used to run the script.")
392
- sys.exit(0)
393
- #raise Exception("Aborted.")
394
- return ob_ATCs
395
- # ------------------------------------------------------------------------------
396
- def oneOB( api, obId ) :
397
- try :
398
- OB, _ = api.getOB(obId)
399
- except p2api.P2Error as e :
400
- ## Looks like this ID is not an OB...
401
- logging.error('OB %d could not be found...' %(obId))
402
- return
403
- except:
404
- raise
405
- ob_info = api.executionTime(obId)
406
- run_info,_=api.getRun(OB['runId'])
407
-
408
- telescope = Observer(location=p2api_utils.telescope_locations[run_info['telescope']])
409
-
410
- if OB['itemType'] not in ['OB',] :
411
- logging.warning('OB %d is not a science OB' %(obId))
412
- return
413
-
414
- if OB['obStatus'] not in ['P','-'] :
415
- logging.warning('OB status is %s, OB not modifiable' %(OB['obstatus']))
416
- return
417
-
418
- runId, _ = api.getRun(OB['runId'])
419
- ob_url=api.apiUrl+'/obsBlocks/'+str(obId)
420
- oneOB_sdt=datetime.datetime.now()
421
- ## For the moment only setting is supported,
422
- ## ToDo: implement support for adding to...
423
- logging.info("Setting Absolute Time Intervals for OBid = %d, OBname = '%s' @ %s..." % (OB['obId'],OB['name'],OB['instrument']))
424
- absTCs, atcVersion = api.getAbsoluteTimeConstraints(obId)
425
-
426
- ob_ATCs=get_ob_ATCs(
427
- telescope=telescope,
428
- ob_info=ob_info,
429
- run_info=run_info,
430
- )
431
-
432
- if not options.dryrun :
433
- api.saveAbsoluteTimeConstraints(
434
- obId,
435
- ob_ATCs,
436
- atcVersion,
437
- )
438
- oneOB_edt=datetime.datetime.now()
439
- logging.info(
440
- "Added %d Absolute Time Intervals for OBid = %d, OBname = '%s' @ %s done in %s."
441
- %(
442
- len(ob_ATCs), obId, OB['name'], OB['instrument'], str(oneOB_edt-oneOB_sdt)
443
- )
444
- )
445
- # ------------------------------------------------------------------------------
446
-
447
- # ------------------------------------------------------------------------------
448
- # ------------------------------------------------------------------------------
449
- # ------------------------------------------------------------------------------
450
-
451
- def main():
452
-
453
- ################################################################################
454
- # remove password from keyring...
455
- if options.pwremove and options.user is not None :
456
- keyring.delete_password('usd_p2api_interactive:www.eso.org', options.user)
457
- sys.exit(0)
458
-
459
- api=p2api_utils.get_api(options)
460
- obIds=p2api_utils.r_get_all_OBIds( api, options.ids.split(',') )
461
-
462
- if len(obIds) > 0 :
463
- if len(obIds) > 1 :
464
- sdt=datetime.datetime.now()
465
- logging.warning('Adding Absolute Time Constraints to %d OBs...' %( len(obIds) ))
466
- for obId in obIds :
467
- oneOB(api, obId, )
468
- if len(obIds) > 1 :
469
- edt=datetime.datetime.now()
470
- logging.info('Total elapsed time to process %d finding charts %s...' %(len(obIds),str(edt-sdt)))
471
- else :
472
- logging.error('No OBs found.')
473
-
474
-
475
- if __name__ == '__main__' :
476
- main()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes