2011-03-14 74 views

回答

4

http://www.cbi.utsa.edu/sge_tutorial

When a Sun Grid Engine job is run, a number of variables are preset into the 
job’s script environment, as listed below. 

SGE_ROOT - The Sun Grid Engine root directory as set for sge_execd before 
    start-up or the default /usr/SGE 
SGE_CELL - The Sun Grid Engine cell in which the job executes 
SGE_JOB_SPOOL_DIR - The directory used by sge_shepherd(8) to store jobrelated 
    data during job execution 
... 
... 

检查%ENV应该告诉你,如果它是通过SGE运行。

+0

其中一些变量存在于我的登录shell环境中。 'SGE_JOB_SPOOL_DIR'似乎不在那里,所以我会去那,谢谢。 – ajwood 2011-03-14 16:06:58

0

你可以尝试这样的事情:

use Proc::ProcessTable; 

my $running_under_sge = 0; 
my $ppid = getppid(); 
my $t = new Proc::ProcessTable; 
foreach my $p (@{$t->table}) { 
    if ($p->pid == $ppid) { 
     if ($p->cmdline =~ m/sge_shepherd/) { 
      $running_under_sge++; 
      last; 
     } 
    } 
} 

这是通过检查你的程序的父进程。如果父进程是sge_shepherd,那么它是由SGE exec守护进程启动的。根据您使用的Grid Engine版本,名称可能会有所不同。

0

jlp提供的脚本是一种彻底的检查方式,并且是我推荐的方式。虽然如果你想做一个简短的陈述来检查你是否有环境工作人员的工作证号。见下面的脚本。

#!/usr/bin/perl 

use strict; 

my $job_id = $ENV{JOB_ID}; 

if ($job_id > 0) { 
    print "Is and SGE job"; 
} else { 
    print "Is NOT and SGE job"; 
} 
相关问题