def collect(sid): # Default access = None client_dir = CLIENT_DIR target_dir = TARGET_DIR # If we run from the titan headnode, collect over GO if 'rp.session.titan' in sid: access = 'go://olcf#dtn' #access = 'go://olcf#dtn_atlas' client_dir = 'go://olcf#dtn/ccs/home/marksant1/ccgrid16/client' #client_dir = 'go://olcf#dtn_atlas/ccs/home/marksant1/ccgrid16/client' target_dir = 'go://localhost%s' % TARGET_DIR # If we ran on another client, only change the client elif 'rp.session.ip-10-184-31-85.santcroos' in sid: client_dir = 'sftp://ec2-107-21-218-167.compute-1.amazonaws.com/home/santcroos/experiments/ccgrid16/client' # elif 'rp.session.radical.marksant' in sid: # client_dir = 'sftp://radserv/home/marksant/sc16/client' elif 'mw.session.netbook.mark' in sid: client_dir = '/Users/mark/proj/openmpi/mysubmit/client' elif 'mw.session' in sid and 'stampede.tacc.utexas.edu.marksant' in sid: client_dir = 'sftp://stampede/work/01740/marksant/client' elif 'mw.session.h2ologin' in sid or 'mw.session.nid' in sid: client_dir = 'gsisftp://bw/u/sciteam/marksant/mysubmit/client' report.info("Collecting profiles for session: %s.\n" % sid) rpu.fetch_profiles(sid=sid, client=client_dir, tgt=target_dir, access=access, skip_existing=True) report.info("Collecting json for session: %s.\n" % sid) rpu.fetch_json(sid, tgt=JSON_DIR, skip_existing=True)
def collect(sid): # Default access = None client_dir = CLIENT_DIR target_dir = TARGET_DIR # If we run from the titan headnode, collect over GO if "rp.session.titan" in sid: access = "go://olcf#dtn" # access = 'go://olcf#dtn_atlas' client_dir = "go://olcf#dtn/ccs/home/marksant1/ccgrid16/client" # client_dir = 'go://olcf#dtn_atlas/ccs/home/marksant1/ccgrid16/client' target_dir = "go://localhost%s" % TARGET_DIR # If we ran on another client, only change the client elif "rp.session.ip-10-184-31-85.santcroos" in sid: client_dir = "sftp://ec2-107-21-218-167.compute-1.amazonaws.com/home/santcroos/experiments/ccgrid16/client" report.info("Collecting profiles for session: %s.\n" % sid) rpu.fetch_profiles(sid=sid, client=client_dir, tgt=target_dir, access=access, skip_existing=True) report.info("Collecting json for session: %s.\n" % sid) rpu.fetch_json(sid, tgt=JSON_DIR, skip_existing=True)
for pid, vals in unit_info.iteritems(): if "Terminated" in vals.keys(): line = "{0}, {1}, {2:0.5f}, {3:0.5f}, None\n".format(pid, vals["Interrupt"], vals["Started"],vals["Terminated"]) f1.write(line) elif "Done" in vals.keys(): line = "{0}, None, {1:0.5f}, None, {2:0.5f}\n".format(pid, vals["Started"],vals["Done"]) f1.write(line) f1.close() import radical.pilot.utils as rpu # we have a session sid = session.uid profiles = rpu.fetch_profiles(sid=sid, tgt='/tmp/') profile = rpu.combine_profiles (profiles) frame = rpu.prof2frame(profile) sf, pf, uf = rpu.split_frame(frame) rpu.add_info(uf) rpu.add_states(uf) adv = uf[uf['event'].isin(['advance'])] rpu.add_frequency(adv, 'f_exe', 0.5, {'state' : 'Executing', 'event' : 'advance'}) s_frame, p_frame, u_frame = rpu.get_session_frames(sid) print str(u_frame)
# Remove units already completed done_units = [cu for cu in units if cu.state == "Done"] for unit in done_units: units.remove(unit) # Wait for processes to finish uids = [cu.uid for cu in units] umgr.wait_units(uids) session.close(cleanup=False) import radical.pilot.utils as rpu # we have a session sid = session.uid profiles = rpu.fetch_profiles(sid=sid, tgt='/tmp/') profile = rpu.combine_profiles(profiles) frame = rpu.prof2frame(profile) sf, pf, uf = rpu.split_frame(frame) rpu.add_info(uf) rpu.add_states(uf) adv = uf[uf['event'].isin(['advance'])] rpu.add_frequency(adv, 'f_exe', 0.5, { 'state': 'Executing', 'event': 'advance' }) s_frame, p_frame, u_frame = rpu.get_session_frames(sid) #print str(u_frame)
# os.remove("converge.txt") except Exception as e: # Something unexpected happened in the pilot code above print "caught Exception: %s" % e raise except (KeyboardInterrupt, SystemExit) as e: # the callback called sys.exit(), and we can here catch the # corresponding KeyboardInterrupt exception for shutdown. We also catch # SystemExit (which gets raised if the main threads exits for some other # reason). print "need to exit now: %s" % e finally: # always clean up the session, no matter if we caught an exception or # not. session.close(cleanup=False) import radical.pilot.utils as rpu # we have a session sid = session.uid profiles = rpu.fetch_profiles(sid=sid, tgt='../reports') profile = rpu.combine_profiles(profiles) frame = rpu.prof2frame(profile) sf, pf, uf = rpu.split_frame(frame) pf.to_html('../reports/pf-{0}-{1}.html'.format(report_name, tasks)) sf.to_html('../reports/sf-{0}-{1}.html'.format(report_name, tasks)) uf.to_html('../reports/uf-{0}-{1}.html'.format(report_name, tasks))
def profile_analysis(sid): import radical.pilot.utils as rpu report.header('profile analysis') # fetch profiles for all pilots profiles = rpu.fetch_profiles(sid=sid, tgt='/tmp/') print(profiles) # combine into a single profile profile = rpu.combine_profiles(profiles) # derive a global data frame frame = rpu.prof2frame(profile) # split into session / pilot / unit frames sf, pf, uf = rpu.split_frame(frame) print(len(sf)) print(len(pf)) print(len(uf)) print(sf[0:10]) print(pf[0:10]) print(uf[0:10]) # derive some additional 'info' columns, which contains some commonly used # tags rpu.add_info(uf) for index, row in uf.iterrows(): if str(row['info']) != 'nan': print("%-20s : %-10s : %-25s : %-20s" % (row['time'], row['uid'], row['state'], row['info'])) # add a 'state_from' columns which signals a state transition rpu.add_states(uf) adv = uf[uf['event'].isin(['advance'])] print('---------------') print(len(adv)) print(uf[uf['uid'] == 'unit.000001']) print(list(pf['event'])) tmp = uf[uf['uid'] == 'unit.000001'].dropna() print(tmp[['time', 'uid', 'state', 'state_from']]) # add a columns 'rate_out' which contains the rate (1/s) of the event # 'advance to state STAGING_OUTPUT' print('---------------') rpu.add_frequency(adv, 'rate_out', 0.5, { 'state': 'StagingOutput', 'event': 'advance' }) print(adv[['time', 'rate_out']].dropna(subset=['rate_out'])) print('---------------') fig, plot = rpu.create_plot() plot.set_title('rate of ouput staging transitions', y=1.05, fontsize=18) plot.set_xlabel('time (s)', fontsize=14) plot.set_ylabel('rate (1/s)', fontsize=14) plot.set_frame_on(True) adv[['time', 'rate_out']].dropna().plot(ax=plot, logx=False, logy=False, x='time', y='rate_out', drawstyle='steps', label='output rate', legend=False) plot.legend(labels=['output rate'], loc='best', fontsize=14, frameon=True) fig.savefig('profile.png', bbox_inches='tight')
pilots = pmgr.submit_pilots(pdescs) report.header('submit units') session.close (cleanup=False) # fetch profiles and convert into inspectable data frames if session: session_id = session.uid : import radical.pilot.utils as rpu # we have a session profiles = rpu.fetch_profiles(sid=session_id, tgt='/tmp/') profile = rpu.combine_profiles (profiles) frame = rpu.prof2frame(profile) sf, pf, uf = rpu.split_frame(frame) # print len(sf) # print len(pf) # print len(uf) # # print sf[0:10] # print pf[0:10] # print uf[0:10] rpu.add_info(uf) rpu.add_states(uf) adv = uf[uf['event'].isin(['advance'])] print len(adv)
def profile_analysis(sid): import radical.pilot.utils as rpu report.header('profile analysis') # fetch profiles for all pilots profiles = rpu.fetch_profiles(sid=sid, tgt='/tmp/') print profiles # combine into a single profile profile = rpu.combine_profiles(profiles) # derive a global data frame frame = rpu.prof2frame(profile) # split into session / pilot / unit frames sf, pf, uf = rpu.split_frame(frame) print len(sf) print len(pf) print len(uf) print sf[0:10] print pf[0:10] print uf[0:10] # derive some additional 'info' columns, which contains some commonly used # tags rpu.add_info(uf) for index, row in uf.iterrows(): if str(row['info']) != 'nan': print "%-20s : %-10s : %-25s : %-20s" % \ (row['time'], row['uid'], row['state'], row['info']) # add a 'state_from' columns which signals a state transition rpu.add_states(uf) adv = uf[uf['event'].isin(['advance'])] print '---------------' print len(adv) print uf[uf['uid'] == 'unit.000001'] print list(pf['event']) tmp = uf[uf['uid'] == 'unit.000001'].dropna() print tmp[['time', 'uid', 'state', 'state_from']] # add a columns 'rate_out' which contains the rate (1/s) of the event # 'advance to state STAGING_OUTPUT' print '---------------' rpu.add_frequency(adv, 'rate_out', 0.5, {'state' : 'StagingOutput', 'event' : 'advance'}) print adv[['time', 'rate_out']].dropna(subset=['rate_out']) print '---------------' fig, plot = rpu.create_plot() plot.set_title('rate of ouput staging transitions', y=1.05, fontsize=18) plot.set_xlabel('time (s)', fontsize=14) plot.set_ylabel('rate (1/s)', fontsize=14) plot.set_frame_on(True) adv[['time', 'rate_out']].dropna().plot(ax=plot, logx=False, logy=False, x='time', y='rate_out', drawstyle='steps', label='output rate', legend=False) plot.legend(labels=['output rate'], loc='best', fontsize=14, frameon=True) fig.savefig('profile.png', bbox_inches='tight')