
import os
import string
import stat
import sys
sys.path.append("lib")
sys.path.append("../lib")

import glideinMonitor

def createDirMonitorFile(monitor_file_name,monitor_control_relname,
                         argv,condor_status):
    fd=open(monitor_file_name,"w")
    try:
        fd.write("#!/bin/sh\n")
        fd.write("outdir=`ls -lt .. | tail -1 | awk '{print $9}'`\n")
        fd.write("(cd ../$outdir; if [ $? -eq 0 ]; then ls %s; else echo Internal error; fi)\n"%(string.join(argv)))
        fd.write("echo Done > %s\n"%monitor_control_relname)
    finally:
        fd.close()

    os.chmod(monitor_file_name,stat.S_IRWXU)


args=glideinMonitor.parseArgs(sys.argv[1:])

glideinMonitor.monitor(args['jid'],args['schedd_name'],args['pool_name'],
                       args['timeout'],
                       createDirMonitorFile,args['argv'])


import os,os.path
import string
import stat
import sys
sys.path.append(os.path.join(os.path[0],"lib"))
sys.path.append(os.path.join(os.path[0],"../lib"))

import glideinMonitor

def createDirMonitorFile(monitor_file_name,monitor_control_relname,
                         argv,condor_status):
    fd=open(monitor_file_name,"w")
    try:
        fd.write("#!/bin/sh\n")
        fd.write("outdir=`ls -lt .. | tail -1 | awk '{print $9}'`\n")
        fd.write("(cd ../$outdir; if [ $? -eq 0 ]; then ls %s; else echo Internal error; fi)\n"%(string.join(argv)))
        fd.write("echo Done > %s\n"%monitor_control_relname)
    finally:
        fd.close()

    os.chmod(monitor_file_name,stat.S_IRWXU)


args=glideinMonitor.parseArgs(sys.argv[1:])

glideinMonitor.monitor(args['jid'],args['schedd_name'],args['pool_name'],
                       args['timeout'],
                       createDirMonitorFile,args['argv'])

Change rel paths into abspaths
Change rel paths into abspaths

  
- import os
+ import os,os.path
  import string
  import stat
  import sys
- sys.path.append("lib")
- sys.path.append("../lib")
+ sys.path.append(os.path.join(os.path[0],"lib"))
+ sys.path.append(os.path.join(os.path[0],"../lib"))
  
  import glideinMonitor
  
  def createDirMonitorFile(monitor_file_name,monitor_control_relname,
                           argv,condor_status):
      fd=open(monitor_file_name,"w")
      try:
          fd.write("#!/bin/sh\n")
          fd.write("outdir=`ls -lt .. | tail -1 | awk '{print $9}'`\n")
          fd.write("(cd ../$outdir; if [ $? -eq 0 ]; then ls %s; else echo Internal error; fi)\n"%(string.join(argv)))
          fd.write("echo Done > %s\n"%monitor_control_relname)
      finally:
          fd.close()
  
      os.chmod(monitor_file_name,stat.S_IRWXU)
  
  
  args=glideinMonitor.parseArgs(sys.argv[1:])
  
  glideinMonitor.monitor(args['jid'],args['schedd_name'],args['pool_name'],
                         args['timeout'],
                         createDirMonitorFile,args['argv'])
  
Change rel paths into abspaths
## Code Before:

import os
import string
import stat
import sys
sys.path.append("lib")
sys.path.append("../lib")

import glideinMonitor

def createDirMonitorFile(monitor_file_name,monitor_control_relname,
                         argv,condor_status):
    fd=open(monitor_file_name,"w")
    try:
        fd.write("#!/bin/sh\n")
        fd.write("outdir=`ls -lt .. | tail -1 | awk '{print $9}'`\n")
        fd.write("(cd ../$outdir; if [ $? -eq 0 ]; then ls %s; else echo Internal error; fi)\n"%(string.join(argv)))
        fd.write("echo Done > %s\n"%monitor_control_relname)
    finally:
        fd.close()

    os.chmod(monitor_file_name,stat.S_IRWXU)


args=glideinMonitor.parseArgs(sys.argv[1:])

glideinMonitor.monitor(args['jid'],args['schedd_name'],args['pool_name'],
                       args['timeout'],
                       createDirMonitorFile,args['argv'])

## Instruction:
Change rel paths into abspaths
## Code After:

import os,os.path
import string
import stat
import sys
sys.path.append(os.path.join(os.path[0],"lib"))
sys.path.append(os.path.join(os.path[0],"../lib"))

import glideinMonitor

def createDirMonitorFile(monitor_file_name,monitor_control_relname,
                         argv,condor_status):
    fd=open(monitor_file_name,"w")
    try:
        fd.write("#!/bin/sh\n")
        fd.write("outdir=`ls -lt .. | tail -1 | awk '{print $9}'`\n")
        fd.write("(cd ../$outdir; if [ $? -eq 0 ]; then ls %s; else echo Internal error; fi)\n"%(string.join(argv)))
        fd.write("echo Done > %s\n"%monitor_control_relname)
    finally:
        fd.close()

    os.chmod(monitor_file_name,stat.S_IRWXU)


args=glideinMonitor.parseArgs(sys.argv[1:])

glideinMonitor.monitor(args['jid'],args['schedd_name'],args['pool_name'],
                       args['timeout'],
                       createDirMonitorFile,args['argv'])
