from _datetime import datetime from time import sleep import pyares as pa import pandas as pd # all solar aspect angles and all the timestamps. params = ['sa', 'sx', 'sy', 'sz'] start = 1388534400000 # GMT: Wednesday, 1 January 2014 00:00:10.697 #end = 1389139200000 # GMT: Wednesday, 8 January 2014 00:00:00 #end = 1420070380120 # Wednesday, 31 December 2014 23:59:40.120 #end = 1388584759000 # Wednesday, 1 January 2014 13:59:19 end = 1388620800000 # GMT: Thursday, 2 January 2014 00:00:00 #end = 1391212800000 # 1 month data_provider = pa.init_aresjob() job_id = data_provider.execute_job(script='mex_job.py', param_names=params, start=start, end=end) start_time = datetime.now() while True: status = data_provider.get_job_status() print(status) if status['Final-State'] == 'SUCCEEDED': print(data_provider.get_job_logs()) print("Time elapsed: %s" % str(datetime.now() - start_time)) retriever = pa.init_param_jobresultretriever().get_job_result_df search = retriever(job_id=job_id, result_type='search')
status = aj_obj.get_job_status() print(status) if status['Final-State'] == 'SUCCEEDED': print("Time elapsed: %s" % str(datetime.now() - start_time)) break if status['Final-State'] == 'FAILED': print("Job failed.") break sleep(10) params = ['sa', 'sx', 'sy', 'sz'] timestamps = sorted([1387424800000, 1388584759000]) #timestamps = sorted([1388534410697, 1420070380120]) # all the timestamps aj = pa.init_aresjob() job_id1 = aj.execute_job(script='job1.py', param_names=params, start=timestamps[0], end=timestamps[-1]) print_status(aj) job_id2 = aj.execute_job(script='job2.py', param_names=params, start=timestamps[0], end=timestamps[-1]) print_status(aj) retriever = pa.init_param_jobresultretriever().get_job_result_df result1 = retriever(job_id=job_id1, result_type='udf') result2 = retriever(job_id=job_id2, result_type='udf')