2011-03-14 6 views

답변

4

: 그것은 SGE를 통해 실행되는 경우

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 당신을 말할 것이다.

+0

일부 변수는 로그인 쉘 환경에 있습니다. 'SGE_JOB_SPOOL_DIR'은 거기에있는 것처럼 보이지 않습니다. 그래서 나는 그걸로 갈 것입니다. 고마워요. – ajwood

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에서 제공하는 스크립트는 철저한 검사 방법이며 권장 방법입니다. 환경에 SGE 작업 ID가 있는지 여부를 확인하기위한 빠른 성명을 원한다면. 아래 스크립트를 참조하십시오.

#!/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"; 
} 
관련 문제