Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

PBS not finding file.

by Jeri (Scribe)
on Sep 27, 2011 at 18:05 UTC ( #928131=perlquestion: print w/replies, xml ) Need Help??
Jeri has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks! I've made a very simple example of my problem. $ARGV[0] is not capturing '1' from my qsub file. Should I not use $ARGV[0]? I've never done this before, and I thought I was going about it right. The code works on my local and remote computer, but complains when I sent it for batch processing.

This is my simple script

#!/usr/bin/perl5.8.8 use strict; use warnings; my $infile = $ARGV[0]; chomp $infile; open (my $INFILE,"<", $infile) close ($INFILE);

This is my qsub script

#PBS -t 1-10 #PBS -l walltime=48:00:00 /usr/bin/perl /chongle/jeri/timecheck/ $PBS_ARRAYID > /cho +ngle/jeri/timecheck/output.$PBS_ARRAYID.txt 2> /chongle/jeri/timechec +k/error.$PBS_ARRAYID.txt

These are my errors

#Use of uninitialized value in concatenation (.) or string at line 18. #Use of uninitialized value in scalar chomp at /chongle/jeri/timecheck +/ line 19. #Use of uninitialized value in open at /chongle#/jeri/timecheck/MUSCLE line 20. #No such file or directory at /chongle/jeri/timecheck/ lin +e 20.

Replies are listed 'Best First'.
Re: PBS not finding file.
by onelesd (Pilgrim) on Sep 27, 2011 at 19:00 UTC

    There is nothing inherently wrong with your first code sample.

    That said, you haven't made it clear how your "qsub script" ties into your example at all, and your error messages don't help us because they are not generated by your example code.

    My (wild) guess is that you call your "simple script" but don't pass it an argument, or are not passing the correct argument, which I am guessing should be your "qsub script".

    Try this:

    my $infile = $ARGV[0]; die "can't read infile\n" if (! -r $infile);

      Your guess is correct! I had a hard time explaining that, yes, the argument should be passed from the qsub script, but it's not. I tried your code. It kills the script, as expected.

        Correction. The argument is not being passed from the qsub script, but should be.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://928131]
Approved by herveus
[erix]: heh

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2018-04-25 17:20 GMT
Find Nodes?
    Voting Booth?