airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] branch master updated: Fix loading queues for given compute resource/deployment
Date Mon, 17 Sep 2018 19:22:22 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/master by this push:
     new 246cccc  Fix loading queues for given compute resource/deployment
246cccc is described below

commit 246cccc2493f0ee85911bf8132b6f71440908d89
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Mon Sep 17 15:22:12 2018 -0400

    Fix loading queues for given compute resource/deployment
---
 .../components/experiment/QueueSettingsEditor.vue  | 520 +++++++++++----------
 1 file changed, 280 insertions(+), 240 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
index 3829958..df86a59 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
@@ -1,264 +1,304 @@
 <template>
 
-    <div>
-        <div class="row">
-            <div class="col">
-                <div class="card border-default">
-                    <div class="card-body">
-                        <h5 class="card-title mb-4">Settings for queue {{ localComputationalResourceScheduling.queueName
}}</h5>
-                        <div class="row">
-                            <div class="col">
-                                <h3 class="h5 mb-0">{{ localComputationalResourceScheduling.nodeCount
}}</h3>
-                                <span class="text-muted text-uppercase">NODE COUNT</span>
-                            </div>
-                            <div class="col">
-                                <h3 class="h5 mb-0">{{ localComputationalResourceScheduling.totalCPUCount
}}</h3>
-                                <span class="text-muted text-uppercase">CORE COUNT</span>
-                            </div>
-                            <div class="col">
-                                <h3 class="h5 mb-0">{{ localComputationalResourceScheduling.wallTimeLimit
}}</h3>
-                                <span class="text-muted text-uppercase">TIME LIMIT</span>
-                            </div>
-                        </div>
-                    </div>
-                </div>
+  <div>
+    <div class="row">
+      <div class="col">
+        <div class="card border-default">
+          <div class="card-body">
+            <h5 class="card-title mb-4">Settings for queue {{ localComputationalResourceScheduling.queueName
}}</h5>
+            <div class="row">
+              <div class="col">
+                <h3 class="h5 mb-0">{{ localComputationalResourceScheduling.nodeCount
}}</h3>
+                <span class="text-muted text-uppercase">NODE COUNT</span>
+              </div>
+              <div class="col">
+                <h3 class="h5 mb-0">{{ localComputationalResourceScheduling.totalCPUCount
}}</h3>
+                <span class="text-muted text-uppercase">CORE COUNT</span>
+              </div>
+              <div class="col">
+                <h3 class="h5 mb-0">{{ localComputationalResourceScheduling.wallTimeLimit
}}</h3>
+                <span class="text-muted text-uppercase">TIME LIMIT</span>
+              </div>
             </div>
+          </div>
         </div>
-        <div class="row">
-            <div class="col">
-                <div v-if="!showConfiguration">
-                    <i class="fa fa-cog text-secondary" aria-hidden="true"></i>
-                    <a class="text-secondary" href="#" @click.prevent="showConfiguration
= true">Configure Resource</a>
-                </div>
-            </div>
+      </div>
+    </div>
+    <div class="row">
+      <div class="col">
+        <div v-if="!showConfiguration">
+          <i class="fa fa-cog text-secondary" aria-hidden="true"></i>
+          <a class="text-secondary" href="#" @click.prevent="showConfiguration = true">Configure
Resource</a>
         </div>
-        <div v-if="showConfiguration">
-            <div class="row">
-                <div class="col">
-                    <b-form-group label="Select a Queue" label-for="queue"
-                        :feedback="getValidationFeedback('queueName')"
-                        :state="getValidationState('queueName')">
-                        <b-form-select id="queue"
-                            v-model="localComputationalResourceScheduling.queueName"
-                            :options="queueOptions" required
-                            @change="queueChanged"
-                            :state="getValidationState('queueName')">
-                        </b-form-select>
-                        <div slot="description">
-                            {{ selectedQueueDefault.queueDescription }}
-                        </div>
-                    </b-form-group>
-                    <b-form-group label="Node Count" label-for="node-count"
-                        :feedback="getValidationFeedback('nodeCount')"
-                        :state="getValidationState('nodeCount')">
-                        <b-form-input id="node-count" type="number" min="1"
-                            :max="maxNodes"
-                            v-model="localComputationalResourceScheduling.nodeCount" required
-                            @input="emitValueChanged"
-                            :state="getValidationState('nodeCount')">
-                        </b-form-input>
-                        <div slot="description">
-                            <i class="fa fa-info-circle" aria-hidden="true"></i>
-                            Max Allowed Nodes = {{ maxNodes }}
-                        </div>
-                    </b-form-group>
-                    <b-form-group label="Total Core Count" label-for="core-count"
-                        :feedback="getValidationFeedback('totalCPUCount')"
-                        :state="getValidationState('totalCPUCount')">
-                        <b-form-input id="core-count" type="number" min="1"
-                            :max="maxCPUCount"
-                            v-model="localComputationalResourceScheduling.totalCPUCount"
required
-                            @input="emitValueChanged"
-                            :state="getValidationState('totalCPUCount')">
-                        </b-form-input>
-                        <div slot="description">
-                            <i class="fa fa-info-circle" aria-hidden="true"></i>
-                            Max Allowed Cores = {{ maxCPUCount }}
-                        </div>
-                    </b-form-group>
-                    <b-form-group label="Wall Time Limit" label-for="walltime-limit"
-                        :feedback="getValidationFeedback('wallTimeLimit')"
-                        :state="getValidationState('wallTimeLimit')">
-                        <b-input-group right="minutes">
-                            <b-form-input id="walltime-limit" type="number" min="1"
-                                :max="maxWalltime"
-                                v-model="localComputationalResourceScheduling.wallTimeLimit"
required
-                                @input="emitValueChanged"
-                                :state="getValidationState('wallTimeLimit')">
-                            </b-form-input>
-                        </b-input-group>
-                        <div slot="description">
-                            <i class="fa fa-info-circle" aria-hidden="true"></i>
-                            Max Allowed Wall Time = {{ maxWalltime }}
-                        </div>
-                    </b-form-group>
-                    <div>
-                        <i class="fa fa-times text-secondary" aria-hidden="true"></i>
-                        <a class="text-secondary" href="#" @click.prevent="showConfiguration
= false">Hide Settings</a>
-                    </div>
-                </div>
+      </div>
+    </div>
+    <div v-if="showConfiguration">
+      <div class="row">
+        <div class="col">
+          <b-form-group label="Select a Queue" label-for="queue" :feedback="getValidationFeedback('queueName')"
:state="getValidationState('queueName')">
+            <b-form-select id="queue" v-model="localComputationalResourceScheduling.queueName"
:options="queueOptions" required @change="queueChanged"
+              :state="getValidationState('queueName')">
+            </b-form-select>
+            <div slot="description">
+              {{ selectedQueueDefault.queueDescription }}
             </div>
+          </b-form-group>
+          <b-form-group label="Node Count" label-for="node-count" :feedback="getValidationFeedback('nodeCount')"
:state="getValidationState('nodeCount')">
+            <b-form-input id="node-count" type="number" min="1" :max="maxNodes" v-model="localComputationalResourceScheduling.nodeCount"
+              required @input="emitValueChanged" :state="getValidationState('nodeCount')">
+            </b-form-input>
+            <div slot="description">
+              <i class="fa fa-info-circle" aria-hidden="true"></i>
+              Max Allowed Nodes = {{ maxNodes }}
+            </div>
+          </b-form-group>
+          <b-form-group label="Total Core Count" label-for="core-count" :feedback="getValidationFeedback('totalCPUCount')"
:state="getValidationState('totalCPUCount')">
+            <b-form-input id="core-count" type="number" min="1" :max="maxCPUCount" v-model="localComputationalResourceScheduling.totalCPUCount"
+              required @input="emitValueChanged" :state="getValidationState('totalCPUCount')">
+            </b-form-input>
+            <div slot="description">
+              <i class="fa fa-info-circle" aria-hidden="true"></i>
+              Max Allowed Cores = {{ maxCPUCount }}
+            </div>
+          </b-form-group>
+          <b-form-group label="Wall Time Limit" label-for="walltime-limit" :feedback="getValidationFeedback('wallTimeLimit')"
:state="getValidationState('wallTimeLimit')">
+            <b-input-group right="minutes">
+              <b-form-input id="walltime-limit" type="number" min="1" :max="maxWalltime"
v-model="localComputationalResourceScheduling.wallTimeLimit"
+                required @input="emitValueChanged" :state="getValidationState('wallTimeLimit')">
+              </b-form-input>
+            </b-input-group>
+            <div slot="description">
+              <i class="fa fa-info-circle" aria-hidden="true"></i>
+              Max Allowed Wall Time = {{ maxWalltime }}
+            </div>
+          </b-form-group>
+          <div>
+            <i class="fa fa-times text-secondary" aria-hidden="true"></i>
+            <a class="text-secondary" href="#" @click.prevent="showConfiguration = false">Hide
Settings</a>
+          </div>
         </div>
+      </div>
     </div>
+  </div>
 </template>
 
 <script>
-import {models, services} from 'django-airavata-api'
-import {utils} from 'django-airavata-common-ui'
+import { models, services } from "django-airavata-api";
+import { utils } from "django-airavata-common-ui";
 
 export default {
-    name: 'queue-settings-editor',
-    props: {
-        value: {
-            type: models.ComputationalResourceSchedulingModel,
-            required: true
-        },
-        appDeploymentId: {
-            type: String,
-            required: true
-        },
-        computeResourcePolicy: {
-            type: models.ComputeResourcePolicy,
-            required: false,
-        },
-        batchQueueResourcePolicies: {
-            type: models.BatchQueueResourcePolicy,
-            required: false,
-        }
+  name: "queue-settings-editor",
+  props: {
+    value: {
+      type: models.ComputationalResourceSchedulingModel,
+      required: true
+    },
+    appDeploymentId: {
+      type: String,
+      required: true
     },
-    data () {
+    computeResourcePolicy: {
+      type: models.ComputeResourcePolicy,
+      required: false
+    },
+    batchQueueResourcePolicies: {
+      type: Array,
+      required: false
+    }
+  },
+  data() {
+    return {
+      localComputationalResourceScheduling: this.value.clone(),
+      queueDefaults: [],
+      showConfiguration: false
+    };
+  },
+  computed: {
+    queueOptions: function() {
+      const queueOptions = this.queueDefaults.map(queueDefault => {
         return {
-            localComputationalResourceScheduling: this.value.clone(),
-            queueDefaults: [],
-            showConfiguration: false,
-        }
+          value: queueDefault.queueName,
+          text: queueDefault.queueName
+        };
+      });
+      return queueOptions;
     },
-    computed: {
-        queueOptions: function() {
-            const queueOptions = this.queueDefaults.map(queueDefault => {
-                return {
-                    value: queueDefault.queueName,
-                    text: queueDefault.queueName,
-                }
-            });
-            return queueOptions;
-        },
-        selectedQueueDefault: function() {
-            return this.queueDefaults.find(queue => queue.queueName === this.localComputationalResourceScheduling.queueName);
-        },
-        maxCPUCount: function() {
-            const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(this.selectedQueueDefault.queueName);
-            if (batchQueueResourcePolicy) {
-                return Math.min(batchQueueResourcePolicy.maxAllowedCores, this.selectedQueueDefault.maxProcessors);
-            }
-            return this.selectedQueueDefault.maxProcessors;
-        },
-        maxNodes: function() {
-            const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(this.selectedQueueDefault.queueName);
-            if (batchQueueResourcePolicy) {
-                return Math.min(batchQueueResourcePolicy.maxAllowedNodes, this.selectedQueueDefault.maxNodes);
-            }
-            return this.selectedQueueDefault.maxNodes;
-        },
-        maxWalltime: function() {
-            const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(this.selectedQueueDefault.queueName);
-            if (batchQueueResourcePolicy) {
-                return Math.min(batchQueueResourcePolicy.maxAllowedWalltime, this.selectedQueueDefault.maxRunTime);
-            }
-            return this.selectedQueueDefault.maxRunTime;
-        }
+    selectedQueueDefault: function() {
+      return this.queueDefaults.find(
+        queue =>
+          queue.queueName ===
+          this.localComputationalResourceScheduling.queueName
+      );
     },
-    methods: {
-        queueChanged: function(queueName) {
-
-            const queueDefault = this.queueDefaults.find(queue => queue.queueName ===
queueName);
-            this.localComputationalResourceScheduling.totalCPUCount = this.getDefaultCPUCount(queueDefault);
-            this.localComputationalResourceScheduling.nodeCount = this.getDefaultNodeCount(queueDefault);
-            this.localComputationalResourceScheduling.wallTimeLimit = this.getDefaultWalltime(queueDefault);
-            this.emitValueChanged();
-        },
-        emitValueChanged: function() {
-            this.$emit('input', this.localComputationalResourceScheduling);
-        },
-        loadQueueDefaults: function() {
-            services.ApplicationDeploymentService.getQueues(this.appDeploymentId)
-                .then(queueDefaults => {
-                    // Sort queue defaults
-                    this.queueDefaults = queueDefaults
-                        .filter(q => this.isQueueInComputeResourcePolicy(q.queueName))
-                        .sort((a, b) => {
-                            // Sort default first, then by alphabetically by name
-                            if (a.isDefaultQueue) {
-                                return -1;
-                            } else if (b.isDefaultQueue) {
-                                return 1;
-                            } else {
-                                return a.queueName.localeCompare(b.queueName);
-                            }
-                    });
-                    // Find the default queue and apply it's settings
-                    const defaultQueue = this.queueDefaults[0];
-
-                    this.localComputationalResourceScheduling.queueName = defaultQueue.queueName;
-                    this.localComputationalResourceScheduling.totalCPUCount = this.getDefaultCPUCount(defaultQueue);
-                    this.localComputationalResourceScheduling.nodeCount = this.getDefaultNodeCount(defaultQueue);
-                    this.localComputationalResourceScheduling.wallTimeLimit = this.getDefaultWalltime(defaultQueue);
-                    this.emitValueChanged();
-                });
-        },
-        isQueueInComputeResourcePolicy: function(queueName) {
-            if (!this.computeResourcePolicy) {
-                return true;
-            }
-            return this.computeResourcePolicy.allowedBatchQueues.includes(queueName);
-        },
-        getBatchQueueResourcePolicy: function(queueName) {
-            if (!this.batchQueueResourcePolicies || this.batchQueueResourcePolicies.length
=== 0) {
-                return null;
-            }
-            return this.batchQueueResourcePolicies.find(bqrp => bqrp.queuename === queueName);
-        },
-        getDefaultCPUCount: function(queueDefault) {
-            const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(queueDefault.queueName);
-            if (batchQueueResourcePolicy) {
-                return Math.min(batchQueueResourcePolicy.maxAllowedCores, queueDefault.defaultCPUCount);
-            }
-            return queueDefault.defaultCPUCount;
-        },
-        getDefaultNodeCount: function(queueDefault) {
-            const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(queueDefault.queueName);
-            if (batchQueueResourcePolicy) {
-                return Math.min(batchQueueResourcePolicy.maxAllowedNodes, queueDefault.defaultNodeCount);
-            }
-            return queueDefault.defaultNodeCount;
-        },
-        getDefaultWalltime: function(queueDefault) {
-            const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(queueDefault.queueName);
-            if (batchQueueResourcePolicy) {
-                return Math.min(batchQueueResourcePolicy.maxAllowedWalltime, queueDefault.defaultWalltime);
+    maxCPUCount: function() {
+      const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
+        this.selectedQueueDefault.queueName
+      );
+      if (batchQueueResourcePolicy) {
+        return Math.min(
+          batchQueueResourcePolicy.maxAllowedCores,
+          this.selectedQueueDefault.maxProcessors
+        );
+      }
+      return this.selectedQueueDefault.maxProcessors;
+    },
+    maxNodes: function() {
+      const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
+        this.selectedQueueDefault.queueName
+      );
+      if (batchQueueResourcePolicy) {
+        return Math.min(
+          batchQueueResourcePolicy.maxAllowedNodes,
+          this.selectedQueueDefault.maxNodes
+        );
+      }
+      return this.selectedQueueDefault.maxNodes;
+    },
+    maxWalltime: function() {
+      const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
+        this.selectedQueueDefault.queueName
+      );
+      if (batchQueueResourcePolicy) {
+        return Math.min(
+          batchQueueResourcePolicy.maxAllowedWalltime,
+          this.selectedQueueDefault.maxRunTime
+        );
+      }
+      return this.selectedQueueDefault.maxRunTime;
+    }
+  },
+  methods: {
+    queueChanged: function(queueName) {
+      const queueDefault = this.queueDefaults.find(
+        queue => queue.queueName === queueName
+      );
+      this.localComputationalResourceScheduling.totalCPUCount = this.getDefaultCPUCount(
+        queueDefault
+      );
+      this.localComputationalResourceScheduling.nodeCount = this.getDefaultNodeCount(
+        queueDefault
+      );
+      this.localComputationalResourceScheduling.wallTimeLimit = this.getDefaultWalltime(
+        queueDefault
+      );
+      this.emitValueChanged();
+    },
+    emitValueChanged: function() {
+      this.$emit("input", this.localComputationalResourceScheduling);
+    },
+    loadQueueDefaults: function() {
+      services.ApplicationDeploymentService.getQueues({
+        lookup: this.appDeploymentId
+      }).then(queueDefaults => {
+        // Sort queue defaults
+        this.queueDefaults = queueDefaults
+          .filter(q => this.isQueueInComputeResourcePolicy(q.queueName))
+          .sort((a, b) => {
+            // Sort default first, then by alphabetically by name
+            if (a.isDefaultQueue) {
+              return -1;
+            } else if (b.isDefaultQueue) {
+              return 1;
+            } else {
+              return a.queueName.localeCompare(b.queueName);
             }
-            return queueDefault.defaultWalltime;
-        },
-        getValidationFeedback: function(properties) {
-            return utils.getProperty(this.localComputationalResourceScheduling.validate(this.selectedQueueDefault,
this.getBatchQueueResourcePolicy(this.selectedQueueDefault.queueName)), properties);
-        },
-        getValidationState: function(properties) {
-            return this.getValidationFeedback(properties) ? 'invalid' : null;
-        },
+          });
+        // Find the default queue and apply it's settings
+        const defaultQueue = this.queueDefaults[0];
+
+        this.localComputationalResourceScheduling.queueName =
+          defaultQueue.queueName;
+        this.localComputationalResourceScheduling.totalCPUCount = this.getDefaultCPUCount(
+          defaultQueue
+        );
+        this.localComputationalResourceScheduling.nodeCount = this.getDefaultNodeCount(
+          defaultQueue
+        );
+        this.localComputationalResourceScheduling.wallTimeLimit = this.getDefaultWalltime(
+          defaultQueue
+        );
+        this.emitValueChanged();
+      });
+    },
+    isQueueInComputeResourcePolicy: function(queueName) {
+      if (!this.computeResourcePolicy) {
+        return true;
+      }
+      return this.computeResourcePolicy.allowedBatchQueues.includes(queueName);
+    },
+    getBatchQueueResourcePolicy: function(queueName) {
+      if (
+        !this.batchQueueResourcePolicies ||
+        this.batchQueueResourcePolicies.length === 0
+      ) {
+        return null;
+      }
+      return this.batchQueueResourcePolicies.find(
+        bqrp => bqrp.queuename === queueName
+      );
+    },
+    getDefaultCPUCount: function(queueDefault) {
+      const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
+        queueDefault.queueName
+      );
+      if (batchQueueResourcePolicy) {
+        return Math.min(
+          batchQueueResourcePolicy.maxAllowedCores,
+          queueDefault.defaultCPUCount
+        );
+      }
+      return queueDefault.defaultCPUCount;
     },
-    watch: {
-        value: function(newValue) {
-            this.localComputationalResourceScheduling = newValue.clone();
-        },
-        appDeploymentId: function(appDeploymentId) {
-            this.loadQueueDefaults();
-        },
+    getDefaultNodeCount: function(queueDefault) {
+      const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
+        queueDefault.queueName
+      );
+      if (batchQueueResourcePolicy) {
+        return Math.min(
+          batchQueueResourcePolicy.maxAllowedNodes,
+          queueDefault.defaultNodeCount
+        );
+      }
+      return queueDefault.defaultNodeCount;
+    },
+    getDefaultWalltime: function(queueDefault) {
+      const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
+        queueDefault.queueName
+      );
+      if (batchQueueResourcePolicy) {
+        return Math.min(
+          batchQueueResourcePolicy.maxAllowedWalltime,
+          queueDefault.defaultWalltime
+        );
+      }
+      return queueDefault.defaultWalltime;
+    },
+    getValidationFeedback: function(properties) {
+      return utils.getProperty(
+        this.localComputationalResourceScheduling.validate(
+          this.selectedQueueDefault,
+          this.getBatchQueueResourcePolicy(this.selectedQueueDefault.queueName)
+        ),
+        properties
+      );
+    },
+    getValidationState: function(properties) {
+      return this.getValidationFeedback(properties) ? "invalid" : null;
+    }
+  },
+  watch: {
+    value: function(newValue) {
+      this.localComputationalResourceScheduling = newValue.clone();
     },
-    mounted: function() {
-        this.loadQueueDefaults();
+    appDeploymentId: function(appDeploymentId) {
+      this.loadQueueDefaults();
     }
-}
+  },
+  mounted: function() {
+    this.loadQueueDefaults();
+  }
+};
 </script>
 
 <style>
-</style>
\ No newline at end of file
+</style>


Mime
View raw message