diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-10-10 08:28:55 +0400 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-10-10 08:28:55 +0400 |
commit | 235dda25e7eb5cb4619a8c2a88ada0cafcb8d13c (patch) | |
tree | 346ccb29f20ba922140f563a18c8f2dced45a5b7 /scripts | |
parent | 71d0d389c5fd7f25b42c0ada827ada8dd800cfa4 (diff) |
extractor wrapper to make it work on SGE
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4315 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generic/moses-parallel.pl | 4 | ||||
-rwxr-xr-x | scripts/generic/qsub-wrapper.pl | 4 | ||||
-rwxr-xr-x | scripts/training/mert-moses.pl | 22 |
3 files changed, 26 insertions, 4 deletions
diff --git a/scripts/generic/moses-parallel.pl b/scripts/generic/moses-parallel.pl index 3139be351..1e8d14eee 100755 --- a/scripts/generic/moses-parallel.pl +++ b/scripts/generic/moses-parallel.pl @@ -454,8 +454,8 @@ while ($robust && scalar @idx_todo) { open (IN,"${jobscript}${idx}.log") or die "Can't read id of job ${jobscript}${idx}.log"; chomp($res=<IN>); - split(/\s+/,$res); - $id=$_[2]; + my @arrayStr = split(/\s+/,$res); + $id=$arrayStr[2]; die "Failed to guess job id from $jobscript$idx.log, got: $res" if $id !~ /^[0-9]+$/; close(IN); diff --git a/scripts/generic/qsub-wrapper.pl b/scripts/generic/qsub-wrapper.pl index 2c90b73d7..65158c00f 100755 --- a/scripts/generic/qsub-wrapper.pl +++ b/scripts/generic/qsub-wrapper.pl @@ -148,8 +148,8 @@ safesystem($qsubcmd) or die; my $res; open (IN,"$jobscript.log") or die "Can't read main job id: $jobscript.log"; chomp($res=<IN>); -split(/\s+/,$res); -my $id=$_[2]; +my @arrayStr = split(/\s+/,$res); +my $id=$arrayStr[2]; die "Failed to get job id from $jobscript.log, got: $res" if $id !~ /^[0-9]+$/; close(IN); diff --git a/scripts/training/mert-moses.pl b/scripts/training/mert-moses.pl index e8124918c..e55f1bead 100755 --- a/scripts/training/mert-moses.pl +++ b/scripts/training/mert-moses.pl @@ -663,6 +663,8 @@ while(1) { my $score_file = "run$run.${base_score_file}"; my $cmd = "$mert_extract_cmd $mert_extract_args --scfile $score_file --ffile $feature_file -r ".join(",", @references)." -n $nbest_file"; + $cmd = create_extractor_script($cmd, $___WORKING_DIR); + &submit_or_exec($cmd,"extract.out","extract.err"); # Create the initial weights file for mert: init.opt @@ -1282,3 +1284,23 @@ sub submit_or_exec { safesystem("$cmd > $stdout 2> $stderr") or die "ERROR: Failed to run '$cmd'."; } } + +sub create_extractor_script() +{ + my ($cmd, $outdir) = @_; + + my $script_path = $outdir."/extractor.sh"; + + open(OUT,"> $script_path") + or die "Can't write $script_path"; + print OUT "#!/bin/bash\n"; + print OUT "cd $outdir\n"; + print OUT $cmd."\n"; + close(OUT); + + `chmod +x $script_path`; + + return $script_path; +} + + |