def execute_job(self, job_url, job_dict):
        """ obtain job attributes from c&c and execute process """
        state=str(job_dict["state"])
       
        #try:
        #   state = self.coordination.get_job_state(job_url)
        #except:
        #    logging.error("Could not access job state... skip execution attempt and requeuing job")
        #    result = self.coordination.queue_job(self.base_url, job_url)
        #    if result == False:
        #        self.coordination.set_job_state(job_url, str(saga.job.Failed))
        
        if(state==str(bigjob.state.Unknown) or
            state==str(bigjob.state.New)):
            try:
                #job_dict["state"]=str(saga.job.New)                
                logging.debug("Start job: " + str(job_dict))        
                numberofprocesses = "1"
                if (job_dict.has_key("NumberOfProcesses") == True):
                    numberofprocesses = job_dict["NumberOfProcesses"]
                
                spmdvariation="single"
                if (job_dict.has_key("SPMDVariation") == True):
                    spmdvariation = job_dict["SPMDVariation"]
                
                arguments = ""
                if (job_dict.has_key("Arguments") == True):
                    arguments_raw = job_dict['Arguments'];
                    if type(arguments_raw) == types.ListType:
                        arguments_list = arguments_raw
                    else:
                        arguments_list = eval(job_dict["Arguments"])                    
                    for i in arguments_list:
                        arguments = arguments + " " + i
                        
                workingdirectory = os.getcwd()
                if (job_dict.has_key("WorkingDirectory") == True):
                        workingdirectory =  job_dict["WorkingDirectory"]
                
                environment = os.environ
                if (job_dict.has_key("Environment") == True):
                    for i in job_dict["Environment"]:
                        env = i.split("=")
                        environment[env[0]]=env[1] + ":" +  environment[env[0]]                        
                        
                environment["PATH"]= workingdirectory + ":"+environment["PATH"]   
                print "environment[PATH]", environment["PATH"]
                executable = job_dict["Executable"]
                
                
                output="stdout"
                if (job_dict.has_key("Output") == True):
                    output = job_dict["Output"]
                        
                error="stderr"
                if (job_dict.has_key("Error") == True):
                    error = job_dict["Error"]
               
                # append job to job list
                self.jobs.append(job_url)
                
                # create stdout/stderr file descriptors
                output_file = os.path.join(workingdirectory, output)
                error_file = os.path.join(workingdirectory, error)
                logging.debug("stdout: " + output_file + " stderr: " + error_file + " env: " + str(environment))
                stdout = open(output_file, "w")
                stderr = open(error_file, "w")
                #if not "/" in executable:
                #         command = workingdirectory +"/" +executable + " " + arguments
                command = executable + " " + arguments
                #pdb.set_trace()
                # special setup for MPI NAMD jobs
                machinefile = self.allocate_nodes(job_dict)
                host = "localhost"
                try:
                    machine_file_handler = open(machinefile, "r")
                    node= machine_file_handler.readlines()
                    machine_file_handler.close()
                    host = node[0].strip()
                except:
                    pass


                if(machinefile==None):
                    logging.debug("Not enough resources to run: " + job_url)
                    self.coordination.queue_job(self.base_url, job_url)
                    return # job cannot be run at the moment

                # start application process
                if (spmdvariation.lower( )=="mpi"):
                    command = "cd " + workingdirectory + "; " + self.MPIRUN + " -np " + numberofprocesses / " -machinefile " + machinefile + " " + command
                    #if (host != socket.gethostname()):
                    #    command ="ssh  " + host + " \"cd " + workingdirectory + "; " + command +"\""     
                else:
                    command ="chmod +x " + executable +";export PATH=$PATH:" + workingdirectory + ";" +command
                shell = self.SHELL 
                logging.debug("execute: " + command + " in " + workingdirectory + " from: " + str(socket.gethostname()) + " (Shell: " + shell +")")
                # bash works fine for launching on QB but fails for Abe :-(
                p = subprocess.Popen(args=command, executable=shell, stderr=stderr,
                                     stdout=stdout, cwd=workingdirectory, 
                                     env=environment, shell=True)
                logging.debug("started " + command)
                
                #for condor debugging 
                dirlist = os.listdir(workingdirectory)
                print dirlist
                os.system("ls;pwd")
                
                self.processes[job_url] = p
                self.coordination.set_job_state(job_url, str(bigjob.state.Running))
            except:
                traceback.print_exc(file=sys.stderr)
dataset/ETHPy150Open saga-project/BigJob/bigjob/bigjob_agent_condor.py/bigjob_agent.execute_job/operator `+` -> `/`