At a minimum, you're going to want a "WAIT" added to your "QUEUE GET" 
request.  Without the "WAIT", the "GET" request will return immediately 
(indicating that there was no element -- you can check the RC for that) 
with no data.

Charles Rankin




From:
"Avijit Roy" <[EMAIL PROTECTED]>
To:
"Edmonds, Michael" <[EMAIL PROTECTED]>, 
<[email protected]>
Date:
10/16/2008 01:57 PM
Subject:
Re: [staf-users] Is there any way to track submitted request status 
completion with basic STAF



I tried with following but didn’t get the expected result. Is there 
anything wrong I am doing?
 
# fill in @machines
 
use strict;
use Data::Dumper;
use lib qw( ... ); # Path to PLSTAF
use PLSTAF;
my $name = "test";
&STAF::Register($name);
 
my $requests = 0;
my $command = "notepad";
my $request = "START COMMAND ".STAF::WrapData($command)."ASYNC 
RETURNSTDOUT STDERRTOSTDOUT NOTIFY ONEND KEY 100";

foreach my $machine (@machines)
{
    if(STAF::Submit($machine, "PROCESS", $request) == $STAF::kOk)
    {
        $requests++;
    }
}
 
if($requests) # I think this test may be redundent
{
    for(1 .. $requests)
    {
        STAF::Submit("local", "QUEUE", "GET TYPE STAF/PROCESS/END ");
        my $result = $STAF::Result;
        my $data;
        if(STAF::STAFIsMarshalledData($result))
        {
            my $mc = STAF::STAFUnmarshall($result);
            $data = $mc->getRootObject()->{message};
        }
        else
        {
            # take care of it
        }
        print Dumper($data);
        # parse it out further to do real work here
    }
}
 
After execution the result
-------------------------------------
$VAR1 = undef;
$VAR1 = undef;
$VAR1 = undef;
 
- Avi
 

From: Edmonds, Michael [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 15, 2008 4:18 PM
To: Avijit Roy; [email protected]
Subject: RE: [staf-users] Is there any way to track submitted request 
status completion with basic STAF
 
that actually is even easier.
 
in the $request, make sure to use the "ASYNC RETURNSTDOUT STDERRTOSTDOUT 
NOTIFY ONEND KEY $some_unique_identifier" keywords (ok, the *STDOUT 
keywords are only if you care about the output of the process, but you can 
figure that part out).  The return code will be there regardless of the 
output though.
 
that way, you don't have to send it asynchronously yourself (the Process 
Service will do it for you -- STAF is so Awesome)
 
then make your request to the QUEUE Service with something like "GET TYPE 
STAF/Process/End"
 
 
Mike
 
 

From: Avijit Roy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 15, 2008 6:38 PM
To: Edmonds, Michael; [email protected]
Subject: RE: [staf-users] Is there any way to track submitted request 
status completion with basic STAF
I am looking more than the process submition result here.
Suppose I submit the following request using submit2 then how to get 
result back that submitted process tasks has completed on machine 1 and 
machine2? 
$result = $handle->submit2("Machine1", "PROCESS", $request);
$result = $handle->submit2("Machine2", "PROCESS", $request);
 

From: Edmonds, Michael [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 15, 2008 3:08 PM
To: Avijit Roy; [email protected]
Subject: RE: [staf-users] Is there any way to track submitted request 
statuscompletion with basic STAF
 
use submit2 (
http://staf.sourceforge.net/current/STAFPerl.htm#Header_Submit2OO) with 
STAF::STAFHandle::kReqQueue
then send a Synchronous request to the QUEUE service for the results of 
those requests.
 

From: Avijit Roy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 15, 2008 5:08 PM
To: [email protected]
Subject: [staf-users] Is there any way to track submitted request 
statuscompletion with basic STAF
Hi,
I am trying to execute some process on 3 different machines from one of 
the driver machine. The main goal is after completion the tasks on three 
different machines, I want to copy the result file from those three 
machines into driver machine and compute the result.
I am using STAF and PERL to do the basic prototype.
My question is after submitting the task using STAF, is there any way to 
check that submitted tasks has completed or not?
 
Here are the following steps which I want to achieve: I am stuck on Step 5 
now.
 
Step 1 - Registering STAF 
Step 2 – Submitting the request on Machine1
Step 3 - Submitting the request on Machine2
Step 4 - Submitting the request on Machine4 
Step 5 – I want to check Step 3, 4 and 5 tasks has completed or not 
----------------------------------->? How should I do that?
Step 6 – If completed all the tasks copy the result file from machine 1, 
2, 3 to driver machine
 
 
Can anybody please suggest me how to work it out?
 
Thanks, Avi
 -------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's 
challenge
Build the coolest Linux based applications with Moblin SDK & win great 
prizes
Grand prize is a trip for two to an Open Source event anywhere in the 
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to