def main(): config['LOG_FILE'] = '/tmp/oar_kamelot.log' logger = get_logger("oar.kamelot", forward_stderr=True) config.setdefault_config(DEFAULT_CONFIG) plt = Platform() logger.debug("argv..." + str(sys.argv)) if len(sys.argv) > 2: schedule_cycle(plt, int(float(sys.argv[2])), sys.argv[1]) elif len(sys.argv) == 2: schedule_cycle(plt, plt.get_time(), sys.argv[1]) else: schedule_cycle(plt, plt.get_time()) logger.info("That's all folks") from oar.lib import db db.commit()
def test_db_job_sorting_simple_priority_no_waiting_time(): config['JOB_SORTING'] = "simple_priority" plt = Platform() now = plt.get_time() # add some resources for i in range(4): db['Resource'].create(network_address="localhost") # add some job with priority for i in range(10): priority = str(float(i)/10.0) insert_job(res=[(60, [('resource_id=4', "")])], submission_time=now, types=['priority='+priority]) schedule_cycle(plt, plt.get_time()) req = db['GanttJobsPrediction'].query\ .order_by(db['GanttJobsPrediction'].start_time)\ .all() flag = True print(req) for r in req: print(r.moldable_id, r.start_time) for i, r in enumerate(req): if i != 0: print(r.moldable_id, prev_id) if r.moldable_id > prev_id: flag = False break prev_id = r.moldable_id assert flag