You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2017/05/16 15:49:55 UTC
airavata-php-gateway git commit: auto updating node/cpu/walltimes in
experiment create and edit
Repository: airavata-php-gateway
Updated Branches:
refs/heads/develop 5ea6293c7 -> 7a7e2f93f
auto updating node/cpu/walltimes in experiment create and edit
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/7a7e2f93
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/7a7e2f93
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/7a7e2f93
Branch: refs/heads/develop
Commit: 7a7e2f93f521c1044ca35c81f843a93f3fc64a90
Parents: 5ea6293
Author: scnakandala <su...@gmail.com>
Authored: Tue May 16 11:49:52 2017 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Tue May 16 11:49:52 2017 -0400
----------------------------------------------------------------------
app/controllers/ExperimentController.php | 8 +-
app/views/experiment/edit.blade.php | 2 +-
app/views/partials/experiment-inputs.blade.php | 3 +-
.../partials/experiment-queue-block.blade.php | 127 +++++++++++--------
4 files changed, 82 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7a7e2f93/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 19f929c..03e4e9c 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -293,6 +293,7 @@ class ExperimentController extends BaseController
$computeResourceId = $experiment->userConfigurationData->computationalResourceScheduling->resourceHostId;
$crResource = CRUtilities::get_compute_resource($computeResourceId);
+ $cpusPerNode = $crResource->cpusPerNode;
if($crResource->defaultNodeCount > 0){
$nodeCount = $crResource->defaultNodeCount;
}
@@ -381,7 +382,8 @@ class ExperimentController extends BaseController
"users" => json_encode($users), "owner" => json_encode($owner),
"canEditSharing" => $canEditSharing,
"projectOwner" => json_encode($projectOwner),
- "updateSharingViaAjax" => false
+ "updateSharingViaAjax" => false,
+ "cpusPerNode" => $cpusPerNode
));
}
else {
@@ -461,6 +463,7 @@ class ExperimentController extends BaseController
$wallTimeLimit = Config::get('pga_config.airavata')["wall-time-limit"];
$crResource = CRUtilities::get_compute_resource($computeResourceId);
+ $cpusPerNode = $crResource->cpusPerNode;
if($crResource->defaultNodeCount > 0){
$nodeCount = $crResource->defaultNodeCount;
}
@@ -506,7 +509,8 @@ class ExperimentController extends BaseController
}
return View::make("partials/experiment-queue-block", array("queues" => $queues, "queueDefaults" => $queueDefaults,
"useUserCRPref" => $userHasComputeResourcePreference,
- "userHasComputeResourcePreference" => $userHasComputeResourcePreference));
+ "userHasComputeResourcePreference" => $userHasComputeResourcePreference,
+ "cpusPerNode" => $cpusPerNode));
}
public function browseView()
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7a7e2f93/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index db21068..fe5fdc9 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -29,7 +29,7 @@
<form action="{{URL::to('/')}}/experiment/edit" method="POST" role="form" enctype="multipart/form-data">
<input type="hidden" name="expId" value="{{{ Input::get('expId') }}}"/>
- @include('partials/experiment-inputs', array( "expInputs", $expInputs))
+ @include('partials/experiment-inputs', array( "expInputs" => $expInputs, "cpusPerNode"=>$cpusPerNode))
@if( count( $expInputs['computeResources']) > 0)
<div class="btn-toolbar">
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7a7e2f93/app/views/partials/experiment-inputs.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-inputs.blade.php b/app/views/partials/experiment-inputs.blade.php
index 956e99d..1318961 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -85,7 +85,8 @@
@include( 'partials/experiment-queue-block', array('queues'=>
$expInputs['expVal']['computeResource']->batchQueues, 'expVal' => $expInputs['expVal'],
'useUserCRPref' => $expInputs['useUserCRPref'],
- 'userHasComputeResourcePreference' => $expInputs['userHasComputeResourcePreference'] ))
+ 'userHasComputeResourcePreference' => $expInputs['userHasComputeResourcePreference'],
+ 'cpusPerNode' => $cpusPerNode))
@endif
</div>
</div>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7a7e2f93/app/views/partials/experiment-queue-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-queue-block.blade.php b/app/views/partials/experiment-queue-block.blade.php
index 4f94e14..5bee34c 100644
--- a/app/views/partials/experiment-queue-block.blade.php
+++ b/app/views/partials/experiment-queue-block.blade.php
@@ -86,7 +86,64 @@
</div>
+@section('scripts')
+@parent
<script>
+ //To work with experiment edit (Not Ajax)
+ $( document ).ready(function() {
+ var selectedQueue = $("#select-queue").val();
+ getQueueData(selectedQueue);
+ $("#select-queue").change(function () {
+ var selectedQueue = $("#select-queue").val();
+ getQueueData(selectedQueue);
+ });
+ });
+
+ $("#enable-auto-scheduling").change(function () {
+ var selectedQueue = $("#select-queue").val();
+ getQueueData(selectedQueue);
+ });
+
+ //Setting the file input view JS code
+ $( document ).ready(function() {
+ function readBlob(opt_startByte, opt_stopByte, fileId) {
+
+ var files = document.getElementById(fileId).files;
+ if (!files.length) {
+ alert('Please select a file!');
+ return;
+ }
+
+ var file = files[0];
+ var start = 0;
+ var stop = Math.min(512*1024,file.size - 1);
+
+ var reader = new FileReader();
+
+ // If we use onloadend, we need to check the readyState.
+ reader.onloadend = function(evt) {
+ if (evt.target.readyState == FileReader.DONE) { // DONE == 2
+ $('#byte_content').html(evt.target.result.replace(/(?:\r\n|\r|\n)/g, '<br />'));
+ $('#byte_range').html(
+ ['Read bytes: ', start + 1, ' - ', stop + 1,
+ ' of ', file.size, ' byte file'].join(''));
+ }
+ };
+
+ var blob = file.slice(start, stop + 1);
+ reader.readAsBinaryString(blob);
+
+ $('#input-file-view').modal('show');
+ }
+
+ $( ".readBytesButtons" ).click(function() {
+ var startByte = $(this).data('startbyte');
+ var endByte = $(this).data('endbyte');
+ var fileId = $(this).data('file-id');
+ readBlob(startByte, endByte, fileId);
+ });
+ });
+
//To work work with experiment create (Ajax)
var selectedQueue = $("#select-queue").val();
getQueueData(selectedQueue);
@@ -162,65 +219,27 @@
}
$(".queue-data").removeClass("hide");
}
-</script>
-
-
-@section('scripts')
-@parent
-<script>
- //To work with experiment edit (Not Ajax)
- $( document ).ready(function() {
- var selectedQueue = $("#select-queue").val();
- getQueueData(selectedQueue);
- $("#select-queue").change(function () {
- var selectedQueue = $("#select-queue").val();
- getQueueData(selectedQueue);
- });
- });
-
- $("#enable-auto-scheduling").change(function () {
- var selectedQueue = $("#select-queue").val();
- getQueueData(selectedQueue);
- });
-
- //Setting the file input view JS code
- $( document ).ready(function() {
- function readBlob(opt_startByte, opt_stopByte, fileId) {
-
- var files = document.getElementById(fileId).files;
- if (!files.length) {
- alert('Please select a file!');
- return;
- }
-
- var file = files[0];
- var start = 0;
- var stop = Math.min(512*1024,file.size - 1);
- var reader = new FileReader();
+ $(document).ready(function(){
+ var cpusPerNode = {{$cpusPerNode}};
+ var nodeCount=$("#node-count");
+ var cpuCount=$("#cpu-count");
- // If we use onloadend, we need to check the readyState.
- reader.onloadend = function(evt) {
- if (evt.target.readyState == FileReader.DONE) { // DONE == 2
- $('#byte_content').html(evt.target.result.replace(/(?:\r\n|\r|\n)/g, '<br />'));
- $('#byte_range').html(
- ['Read bytes: ', start + 1, ' - ', stop + 1,
- ' of ', file.size, ' byte file'].join(''));
+ if(cpusPerNode > 0){
+ nodeCount.keyup(function(){
+ var nodeCountVal = parseInt(nodeCount.val());
+ if(nodeCountVal > 0){
+ cpuCount.val(nodeCountVal*cpusPerNode);
}
- };
+ });
- var blob = file.slice(start, stop + 1);
- reader.readAsBinaryString(blob);
-
- $('#input-file-view').modal('show');
+ cpuCount.keyup(function(){
+ var cpuCountVal = parseInt(cpuCount.val());
+ if(cpuCountVal > 0){
+ nodeCount.val(Math.ceil(cpuCountVal/cpusPerNode));
+ }
+ });
}
-
- $( ".readBytesButtons" ).click(function() {
- var startByte = $(this).data('startbyte');
- var endByte = $(this).data('endbyte');
- var fileId = $(this).data('file-id');
- readBlob(startByte, endByte, fileId);
- });
});
</script>
@stop
\ No newline at end of file