Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def apply_patch(self, patch_file):
ClusterSCP(self.config, [patch_file, "remote:"+self.remote_directory()+"/"+patch_file])
cd_cmd = self.cd_to_code()
patch_cmd = "patch -p1 < " + patch_file
retcodes = ClusterRun(self.config, ClusterRunConcatCommands([cd_cmd, patch_cmd]))
return ClusterRunSummaryCode(retcodes)
def push_init_data(self):
# If we're using a dump file, push it
if (len(self.settings.object_pack)):
ClusterSCP(self.config, [self.settings.object_pack, self.pack_filename(self.settings.object_pack)], io=self.io)
if (len(self.settings.object_sl_file)):
ClusterSCP(self.config, [self.settings.object_sl_file, self.pack_filename(self.settings.object_sl_file)], io=self.io)
if (len(self.settings.message_trace_file)):
print "coopying ",self.settings.message_trace_file, self.pack_filename(self.settings.message_trace_file)
ClusterSCP(self.config, [self.settings.message_trace_file, self.pack_filename(self.settings.message_trace_file)], io=self.io)
def apply_patch_mail(self, patch_file):
ClusterSCP(self.config, [patch_file, "remote:"+self.remote_directory()+"/"+patch_file])
cd_cmd = self.cd_to_code()
patch_cmd = "git am " + patch_file
retcodes = ClusterRun(self.config, ClusterRunConcatCommands([cd_cmd, patch_cmd]))
return ClusterRunSummaryCode(retcodes)
def oprofile(self, binary):
cd_code_cmd = self.cd_to_code()
cd_scripts_cmd = self.cd_to_scripts()
prof_cmd = "opreport \\*cbr\\* > oprofile.out"
prof_cmd += "; opreport -l \\*cbr\\* >> oprofile.out"
retcodes = ClusterRun(self.config, ClusterRunConcatCommands([cd_code_cmd, cd_scripts_cmd, prof_cmd]))
oprof_pattern = "oprofile-%(node)04d.txt"
ClusterSCP(self.config, ["remote:"+self.config.code_dir+"/scripts/oprofile.out", oprof_pattern])
return ClusterRunSummaryCode(retcodes)
def retrieve_data(self):
# Copy the trace and sync data back here
trace_file_pattern = "remote:" + self.scripts_dir() + "trace-%(node)04d.txt"
ClusterSCP(self.config, [trace_file_pattern, "."], io=self.io)
# If one was dumped, pull the dump file
if (len(self.settings.pack_dump)):
ClusterSCP(self.config, [self.pack_filename(self.settings.pack_dump), "."], io=self.io)
def profile(self, binary):
cd_code_cmd = self.cd_to_code()
cd_scripts_cmd = self.cd_to_scripts()
prof_cmd = "gprof ../build/cmake/%s > gprof.out" % (binary)
retcodes = ClusterRun(self.config, ClusterRunConcatCommands([cd_code_cmd, cd_scripts_cmd, prof_cmd]))
gprof_pattern = "gprof-%(node)04d.txt"
ClusterSCP(self.config, ["remote:"+self.config.code_dir+"/scripts/gprof.out", gprof_pattern])
return ClusterRunSummaryCode(retcodes)
def __init__(self, config, space_svr_pool, layout, num_object_hosts):
self.config = config
self.scp=ClusterSCP
self.layout_x = layout[0]
self.layout_y = layout[1]
self.duration = '120s'
self.region_weight = 'sqr'
self.region_weight_options = '--flatness=8'
self.server_queue = 'fair'
self.server_queue_length = 8192
self.odp_flow_scheduler = 'region'
# OH: basic oh settings
self.num_oh = num_object_hosts
self.object_connect_phase = '10s'
def apply_patchset(self):
# Setup all possible necessary commands, then filter out based on files
file_cmds = [ ('git am', self.patchmail_file),
('patch -p1 <', self.patch_file)
]
to_do = [ (cmd,file) for (cmd,file) in file_cmds if os.stat(file)[stat.ST_SIZE] > 0 ]
# Copy files over
scp_args = [ file for (cmd,file) in to_do ]
scp_args.append("remote:"+self.remote_directory()+"/")
ClusterSCP(self.config, scp_args)
# Perform actual patching
cd_cmd = self.cd_to_code()
patch_cmds = [ (cmd + ' ' + file) for (cmd, file) in to_do ]
cmds = [cd_cmd]
cmds.extend(patch_cmds)
retcodes = ClusterRun(self.config, ClusterRunConcatCommands(cmds))
return ClusterRunSummaryCode(retcodes)