def test_expandDates(self): """expandDates""" d1 = datetime.datetime(2013, 1, 1) d2 = datetime.datetime(2013, 1, 2) d3 = datetime.datetime(2013, 1, 3) self.assertEqual(list(Utils.expandDates(d1, d1)), [d1]) self.assertEqual(list(Utils.expandDates(d1, d2)), [d1, d2]) self.assertEqual(list(Utils.expandDates(d1, d3)), [d1, d2, d3])
(options, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments") conffile = os.path.expanduser(os.path.expandvars(os.path.abspath(args[0]))) if not os.path.isfile(conffile): parser.error("could not read config file: {0}".format(conffile)) conf = readconfig(conffile) conf = _processSubs(conf) conf = _processDates(conf) print('Read and parsed config file: {0}'.format(conffile)) # figure out the dates we are going to use # make a range of dates dates = list(Utils.expandDates(conf['settings']['startdate'], conf['settings']['enddate'])) dates = [v.date() for v in dates] dates = list(Utils.chunker(dates, int(conf['panel']['daysperplot']))) # make the arrays that hold the files dbu = DButils.DButils(conf['settings']['mission'], echo=echo) # go through the panel and see how many plots there are nplots = _get_nplots(conf) ans = [] for pnum, ind_pnum in enumerate(range(nplots), 1): ans.append([]) n_prods = _get_nproducts(conf, pnum) prods = []
startDate = dup.parse(options.startDate) else: startDate = datetime.datetime(2012, 8, 30) if options.endDate is not None: endDate = dup.parse(options.endDate) else: endDate = datetime.datetime.now() if endDate < startDate: parser.error("endDate must be >= to startDate") pq = dbprocessing.ProcessQueue(options.mission, dryrun=options.dryrun, echo=options.echo) dates = Utils.expandDates(startDate, endDate) print('dates', list(dates)) inproc = args[0] # get the input products for a process products = pq.dbu.getInputProductID(inproc) print('products', products) runme = [] for d in dates: print("Processing date: {0}".format(d)) # we need a file_id that goes into the process input_files = [] for p, opt in products: prod_ = pq.dbu.getEntry('Product', p)