You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by Abhishek Kapoor <ab...@gmail.com> on 2015/06/07 10:21:11 UTC

Create Experiment in PHP

Hello all,
I am creating an experiment in php using
$input = new InputDataObjectType();
$input->name = "input";
$input->value = $inp;
$input->type = DataType::STRING;
$exInputs = array($input);
$output = new OutputDataObjectType();
$output->name = "output";
$output->value = "";
$output->type = DataType::STDOUT;
$err = new OutputDataObjectType();
$err->name = "output_err";
$err->value = "";
$err->type = DataType::STDERR;
$exOutputs = array($output,$err);

/* Create Experiment: needs to update using unique project ID. */
$user = $usrName;
$exp_name = $expName;
$proj = $projId;

$experiment = new Experiment();
$experiment->projectID = $proj;
$experiment->userName = $user;
$experiment->name = $exp_name;
$experiment->applicationId = $appId;
$experiment->experimentInputs = $exInputs;
$experiment->experimentOutputs = $exOutputs;
 $computeResources  =
$airavataclient>getAvailableAppInterfaceComputeResources($execId);
    if(isset($computeResources) && !empty($computeResources)){
     foreach ($computeResources as $cmR) {
     if($cmR == "localhost"){
$cmRST = new ComputationalResourceScheduling();
$cmRST->resourceHostId = "localhost";
$cmRST->computationalProjectAccount = "ixxi-2013";
$cmRST->nodeCount = 1;
$cmRST->numberOfThreads = 1;
$cmRST->queueName = "normal";
$cmRST->totalCPUCount = 1;
$cmRST->wallTimeLimit = 30;
$cmRST->jobStartTime = 0;
$cmRST->totalPhysicalMemory = 1;
$userConfigurationData = new UserConfigurationData();
$userConfigurationData->airavataAutoSchedule = 0;
$userConfigurationData>overrideManualScheduledParams = 0;
$userConfigurationData->computationalResourceScheduling = $cmRST;
$experiment->userConfigurationData = $userConfigurationData;
     }
     }
    }
$expId = $airavataclient->createExperiment($experiment);

but when I am launching the experiment I'm getting arrayindexoutofbound
error but then I created an experiment in java and used that experiment Id
to launch experiment in php and its working fine. So, then again I tried to
create experiment in php and launch it using java api and I am getting the
same error in java also.
So, it seems like I am missing something during creating experiment in php.
As the code samples given for php in airavata are out-of-date so they are
not working.
Any suggestions ??

-- 
Regards,
*Abhishek Kapoor*
*Under Graduate Student*
*Indian Institute of Technology Kharagpur.*

Re: Create Experiment in PHP

Posted by Emre Brookes <em...@biochem.uthscsa.edu>.
Hi Abhishek,

If you are still using Airavata .14, move to .15.

If you are using .15:

One option:

The php reference gateway itself should be a good php client reference 
(it appears to be working to create and launch experiments)

airavata-php-gateway $ find . -type f | xargs grep -l createExperiment
./app/libraries/ExperimentUtilities.php
./app/libraries/Airavata/API/Airavata.php

If the code alone isn't sufficient for your answer, you should *run* the 
php reference gateway,
against your Airavata server and see if you get the same error or not.
If not, you could put in some debugging .. I typically put in similar to:
  error_log( "in function() line NNN: experiment object:\n" . print_r( 
$experiment, true ), 3, "/tmp/phperrors" ) );
at key places in the code.
(I tend to prefer a file output such as /tmp/phperrors for heavy 
debugging as error log thru syslog makes multi-line information 
messy...  maybe a file can be configured in php.ini, but I've never tried)

Another option:

Maybe you can get the experiment info via the api on experiments created 
by the php and java clients then output & compare.
e.g. getExperiment or other api calls ?

Final option:

Create pull requests to make your code available to others to debug.

-Emre

Abhishek Kapoor wrote:
> Hello all,
> I am creating an experiment in php using
> $input = new InputDataObjectType();
> $input->name = "input";
> $input->value = $inp;
> $input->type = DataType::STRING;
> $exInputs = array($input);
> $output = new OutputDataObjectType();
> $output->name = "output";
> $output->value = "";
> $output->type = DataType::STDOUT;
> $err = new OutputDataObjectType();
> $err->name = "output_err";
> $err->value = "";
> $err->type = DataType::STDERR;
> $exOutputs = array($output,$err);
>
> /* Create Experiment: needs to update using unique project ID. */
> $user = $usrName;
> $exp_name = $expName;
> $proj = $projId;
>
> $experiment = new Experiment();
> $experiment->projectID = $proj;
> $experiment->userName = $user;
> $experiment->name = $exp_name;
> $experiment->applicationId = $appId;
> $experiment->experimentInputs = $exInputs;
> $experiment->experimentOutputs = $exOutputs;
>  $computeResources  = 
> $airavataclient>getAvailableAppInterfaceComputeResources($execId);
>  if(isset($computeResources) && !empty($computeResources)){
> foreach ($computeResources as $cmR) {
> if($cmR == "localhost"){
> $cmRST = new ComputationalResourceScheduling();
> $cmRST->resourceHostId = "localhost";
> $cmRST->computationalProjectAccount = "ixxi-2013";
> $cmRST->nodeCount = 1;
> $cmRST->numberOfThreads = 1;
> $cmRST->queueName = "normal";
> $cmRST->totalCPUCount = 1;
> $cmRST->wallTimeLimit = 30;
> $cmRST->jobStartTime = 0;
> $cmRST->totalPhysicalMemory = 1;
> $userConfigurationData = new UserConfigurationData();
> $userConfigurationData->airavataAutoSchedule = 0;
> $userConfigurationData>overrideManualScheduledParams = 0;
> $userConfigurationData->computationalResourceScheduling = $cmRST;
> $experiment->userConfigurationData = $userConfigurationData;
> }
> }
>    }
> $expId = $airavataclient->createExperiment($experiment);
>
> but when I am launching the experiment I'm getting 
> arrayindexoutofbound error but then I created an experiment in java 
> and used that experiment Id to launch experiment in php and its 
> working fine. So, then again I tried to create experiment in php and 
> launch it using java api and I am getting the same error in java also.
> So, it seems like I am missing something during creating experiment in 
> php.
> As the code samples given for php in airavata are out-of-date so they 
> are not working.
> Any suggestions ??
>
> -- 
> Regards,
> *Abhishek Kapoor*
> *Under Graduate Student*
> *Indian Institute of Technology Kharagpur.*
>
>