You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by nd...@apache.org on 2016/11/01 23:03:11 UTC

airavata-php-gateway git commit: Adding Cloud Job Submission

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 4ea44b18c -> 693db4ee5


Adding Cloud Job Submission


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/693db4ee
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/693db4ee
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/693db4ee

Branch: refs/heads/develop
Commit: 693db4ee5919c4b66b2acbb4cda9e0af5512fc3e
Parents: 4ea44b1
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Tue Nov 1 16:02:36 2016 -0700
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Tue Nov 1 16:02:36 2016 -0700

----------------------------------------------------------------------
 app/libraries/CRUtilities.php     | 33 +++++++++++++++++++--
 app/views/resource/edit.blade.php | 52 +++++++++++++++++++++++++++-------
 public/js/script.js               |  9 +++---
 3 files changed, 77 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/693db4ee/app/libraries/CRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php
index ae3e1ad..3349961 100755
--- a/app/libraries/CRUtilities.php
+++ b/app/libraries/CRUtilities.php
@@ -21,6 +21,8 @@ use Airavata\Model\Data\Movement\SecurityProtocol;
 use Airavata\Model\AppCatalog\ComputeResource\SSHJobSubmission;
 use Airavata\Model\Data\Movement\UnicoreDataMovement;
 use Airavata\Model\AppCatalog\ComputeResource\UnicoreJobSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\CloudJobSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\ProviderName;
 use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
 use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
 use Airavata\Model\AppCatalog\Parallelism\ApplicationParallelismType;
@@ -84,6 +86,7 @@ class CRUtilities
         $jmc = new JobManagerCommand();
         $mm = new MonitorMode();
         $pt = new ApplicationParallelismType();
+        $pn = new ProviderName();
         return array(
             "fileSystemsObject" => $files,
             "fileSystems" => $files::$__names,
@@ -97,7 +100,8 @@ class CRUtilities
             "dataMovementProtocols" => $dmp::$__names,
             "jobManagerCommands" => $jmc::$__names,
             "monitorModes" => $mm::$__names,
-            "parallelismTypes" => $pt::$__names
+            "parallelismTypes" => $pt::$__names,
+            "providerNames" => $pn::$__names
         );
     }
 
@@ -265,7 +269,31 @@ class CRUtilities
                 $unicoreSub = Airavata::addUNICOREJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreJobSubmission);
             }
             return;
-        } else /* Globus does not work currently */ {
+        } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::CLOUD) {
+            $cloudJobSubmission = new CloudJobSubmission(array
+                (
+                    "securityProtocol" => intval($inputs["securityProtocol"]),
+                    "nodeId" => $inputs["nodeId"],
+                    "executableType" => $inputs["executableType"],
+                    "providerName" => intval( $inputs["providerName"]),
+                    "userAccountName" => $inputs["userAccountName"]
+                )
+            );
+            if ($update) {
+                $jsiObject = Airavata::getCloudJobSubmission(Session::get('authz-token'), $jsiId);
+                $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+                $jsiObject->nodeId = $inputs["nodeId"];
+                $jsiObject->executableType = $inputs["executableType"];
+                $jsiObject->providerName = intval( $inputs["providerName"]);
+                $jsiObject->userAccountName = $inputs["userAccountName"];
+
+                $cloudSub = Airavata::updateCloudJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+            } else {
+                $cloudSub = Airavata::addCloudJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $cloudJobSubmission);
+            }
+            return;
+        }
+        else /* Globus does not work currently */ {
             print_r("Whoops! We haven't coded for this Job Submission Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
         }
     }
@@ -659,7 +687,6 @@ class CRUtilities
         }
         return $dspArray;
     }
-
 }
 
 ?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/693db4ee/app/views/resource/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/resource/edit.blade.php b/app/views/resource/edit.blade.php
index f55fddb..e2d3e75 100644
--- a/app/views/resource/edit.blade.php
+++ b/app/views/resource/edit.blade.php
@@ -285,6 +285,37 @@
                                     <label class="form-label">Unicore End Point URL</label>
                                     <input class='form-control' name='unicoreEndPointURL' value="{{ $JSI->unicoreEndPointURL }}"/>
                                 </div>
+                                @elseif( $selectedJspIndex == $jobSubmissionProtocolsObject::CLOUD)
+                                <div class="form-group required">
+                                    <label class="control-label">Select Security Protocol</label>
+                                    <select name="securityProtocol" required="required">
+                                        @foreach( $securityProtocols as $index => $sp)
+                                        <option value="{{ $index }}"
+                                        @if( $JSI->securityProtocol == $index ) selected @endif>{{ $sp }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <div class="form-group">
+                                    <label class="control-label">Node Id</label>
+                                    <input class="form-control" name="nodeId" placeholder="node Id" value="{{$JSI->nodeId}}"/>
+                                </div>
+                                <div class="form-group">
+                                    <label class="control-label">Executable Type</label>
+                                    <input class="form-control" name="executableType" placeholder="executableType" value="{{$JSI->executableType}}" />
+                                </div>
+                                <div class="form-group">
+                                    <label class="control-label">Select Provider Name</label>
+                                    <select class="form-control" name="providerName">
+                                        <option>Provider Name</option>
+                                        @foreach( $providerNames as $index => $pn)
+                                            <option value="{{$index}}" @if( $JSI->providerName == $index) selected @endif>{{ $pn}}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <div class="form-group">
+                                    <label class="control-label">User Account Name</label>
+                                    <input class="form-control" name="userAccountName" placeholder="user Account Name" value="{{$JSI->userAccountName}}"/>
+                                </div>
                                 @endif
 
                                 <div class="form-group">
@@ -542,24 +573,25 @@
             <div class="cloud-block hide">
                 <div class="form-group">
                     <label class="control-label">Node Id</label>
-                    <input class="form-control" name="nodeId" placeholder="nodId"/>
-                </div>
-                <div class="form-group">
-                    <label class="control-label">Node Id</label>
-                    <input class="form-control" name="nodeId" placeholder="nodId"/>
+                    <input class="form-control" name="nodeId" placeholder="node Id"/>
                 </div>
                 <div class="form-group">
                     <label class="control-label">Executable Type</label>
-                    <input class="form-control" name="nodeId" placeholder="executableType"/>
+                    <input class="form-control" name="executableType" placeholder="executableType"/>
                 </div>
                 <div class="form-group">
                     <label class="control-label">Select Provider Name</label>
-                    <select class="form-control">
-                        <option name="EC2">EC2</option>
-                        <option name="AWSEC2">AWEC2</option>
-                        <option name="RACKSPACE">RACKSPACE</option>
+                    <select class="form-control" name="providerName">
+                        <option>ProviderName</option>
+                        @foreach( $providerNames as $index => $pn)
+                            <option value="{{$index}}">{{ $pn}}</option>
+                        @endforeach
                     </select>
                 </div>
+                <div class="form-group">
+                    <label class="control-label">User Account Name</label>
+                    <input class="form-control" name="userAccountName" placeholder="user Account Name"/>
+                </div>
             </div>
 
             <div class="dm-gridftp hide">

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/693db4ee/public/js/script.js
----------------------------------------------------------------------
diff --git a/public/js/script.js b/public/js/script.js
index b3e6732..c2727c7 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -121,13 +121,14 @@ $(document).ready( function(){
     }
     else if( selectedVal == "cloud")
     {
-      alert("Cloud Protool is not being setup right now. Please choose another option.");
-      /*
+      //alert("Cloud Protool is not being setup right now. Please choose another option.");
+      
       $(this).parent().append(  parentResDiv 
                       + $(".ssh-block").html()
                       + $(".cloud-block").html()
+                      + "<div>"
                       );
-      */
+      
     }
     else{
       alert("Something went wrong. Please try again");
@@ -135,7 +136,7 @@ $(document).ready( function(){
     }
 
     //temporary till all protocols are not setup
-    if( selectedVal == "local" || selectedVal == "ssh_fork" || selectedVal == "ssh" || selectedVal == "unicore" )
+    if( selectedVal == "local" || selectedVal == "ssh_fork" || selectedVal == "ssh" || selectedVal == "unicore" || selectedVal == "cloud")
       $(".jspSubmit").removeClass("hide");
     else
       $(".jspSubmit").addClass("hide");