def spawn_job(machine_list, command, working_dir, graphite_home): graphite_procs = {} # spawn for i in range(0, len(machine_list)): if (machine_list[i] == "localhost") or (machine_list[i] == r'127.0.0.1'): exec_command = "%s" % (command) print "%s Starting process: %d: %s" % (pmaster(), i, exec_command) graphite_procs[i] = spawn.spawn_job(i, exec_command, graphite_home) else: command = command.replace("\"", "\\\"") spawn_slave_command = "python -u %s/tools/spawn_slave.py %s %d \\\"%s\\\"" % ( graphite_home, working_dir, i, command) exec_command = "ssh -x %s \"%s\"" % (machine_list[i], spawn_slave_command) print "%s Starting process: %d: %s" % (pmaster(), i, exec_command) graphite_procs[i] = subprocess.Popen(exec_command, shell=True, preexec_fn=os.setsid) return graphite_procs
def spawn_job(machine_list, command, working_dir, graphite_home): procs = {} # spawn for i in range(0, len(machine_list)): if (machine_list[i] == "localhost") or (machine_list[i] == r'127.0.0.1'): exec_command = "%s" % (command) print "%s Starting process: %d: %s" % (pmaster(), i, exec_command) procs[i] = spawn.spawn_job(i, exec_command, graphite_home) else: command = command.replace("\"", "\\\"") spawn_slave_command = "%s/tools/spawn_slave.py %s %d \\\"%s\\\"" % (graphite_home, working_dir, i, command) exec_command = "ssh -x %s \"%s\"" % (machine_list[i], spawn_slave_command) print "%s Starting process: %d: %s" % (pmaster(), i, exec_command) procs[i] = subprocess.Popen(exec_command, shell=True, preexec_fn=os.setsid) return procs
def spawn_job(proc_num, command, working_dir): exec_command = "cd %s; %s" % (working_dir, command) print "%s Starting process: %d: %s" % (pslave(), proc_num, exec_command) sys.stdout.flush() return spawn.spawn_job(proc_num, exec_command)
def spawn(self): self.pid = spawn.spawn_job(self.machines, self.command)
def spawn_job(proc_num, command, working_dir, graphite_home): exec_command = "cd %s; %s" % (working_dir, command) print "%s Starting process: %d: %s" % (pslave(), proc_num, exec_command) graphite_proc = spawn.spawn_job(proc_num, exec_command, graphite_home) renew_permissions_proc = spawn.spawn_renew_permissions_proc() return [graphite_proc, renew_permissions_proc]
def spawn_job(proc_num, command, working_dir, graphite_home): exec_command = "cd %s; %s" % (working_dir, command) print "%s Starting process: %d: %s" % (pslave(), proc_num, exec_command) sys.stdout.flush() return spawn.spawn_job(proc_num, exec_command, graphite_home)