You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/05/13 21:19:00 UTC

[airavata-django-portal] branch airavata-3453 updated (c1e7694 -> 2ca4a78)

This is an automated email from the ASF dual-hosted git repository.

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


    from c1e7694  AIRAVATA-3453 Implemented queue settings editor
     new 9d3a3db  AIRAVATA-3453 Apply GRP policy when it loads/changes
     new 25293ca  AIRAVATA-3453 Handle user no longer has access to GRP
     new 2ca4a78  AIRAVATA-3453 Add icons

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 django_airavata/apps/workspace/package.json        |   3 +
 .../GroupResourceProfileSelector.vue               |   5 +
 .../js/web-components/QueueSettingsEditor.vue      |  47 +++++++--
 .../js/web-components/ResourceSelectionEditor.vue  | 114 +++++++++++++++------
 .../js/web-components/store.js                     |  19 +++-
 django_airavata/apps/workspace/yarn.lock           |  24 +++++
 6 files changed, 169 insertions(+), 43 deletions(-)

[airavata-django-portal] 03/03: AIRAVATA-3453 Add icons

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2ca4a789c9344acfa87ad35a582523e7d77d95f1
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu May 13 17:18:48 2021 -0400

    AIRAVATA-3453 Add icons
---
 django_airavata/apps/workspace/package.json        |  3 ++
 .../js/web-components/QueueSettingsEditor.vue      | 47 +++++++++++++++++-----
 django_airavata/apps/workspace/yarn.lock           | 24 +++++++++++
 3 files changed, 63 insertions(+), 11 deletions(-)

diff --git a/django_airavata/apps/workspace/package.json b/django_airavata/apps/workspace/package.json
index 883c65d..d351fbb 100644
--- a/django_airavata/apps/workspace/package.json
+++ b/django_airavata/apps/workspace/package.json
@@ -17,6 +17,9 @@
     "wc:watch": "WC_MODE='true' vue-cli-service build --target wc --inline-vue --name adpf './static/django_airavata_workspace/js/web-components/*.vue' --dest ./static/django_airavata_workspace/wc --watch"
   },
   "dependencies": {
+    "@fortawesome/fontawesome-svg-core": "^1.2.35",
+    "@fortawesome/free-solid-svg-icons": "^5.15.3",
+    "@fortawesome/vue-fontawesome": "^2.0.2",
     "bootstrap": "^4.3.1",
     "bootstrap-vue": "2.0.0-rc.26",
     "codemirror": "5.52.2",
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/QueueSettingsEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/QueueSettingsEditor.vue
index 6f04b3d..0db908d 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/QueueSettingsEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/QueueSettingsEditor.vue
@@ -62,7 +62,7 @@
         >
         </b-form-input>
         <div slot="description">
-          <i class="fa fa-info-circle" aria-hidden="true"></i>
+          <font-awesome-icon :icon="infoIcon" />
           Max Allowed Nodes = {{ maxAllowedNodes }}
         </div>
       </b-form-group>
@@ -78,7 +78,7 @@
         >
         </b-form-input>
         <div slot="description">
-          <i class="fa fa-info-circle" aria-hidden="true"></i>
+          <font-awesome-icon :icon="infoIcon" />
           Max Allowed Cores = {{ maxAllowedCores }}
         </div>
       </b-form-group>
@@ -96,7 +96,7 @@
           </b-form-input>
         </b-input-group>
         <div slot="description">
-          <i class="fa fa-info-circle" aria-hidden="true"></i>
+          <font-awesome-icon :icon="infoIcon" />
           Max Allowed Wall Time = {{ maxAllowedWalltime }} minutes
         </div>
       </b-form-group>
@@ -117,18 +117,14 @@
           </b-form-input>
         </b-input-group>
         <div slot="description">
-          <i class="fa fa-info-circle" aria-hidden="true"></i>
+          <font-awesome-icon :icon="infoIcon" />
           Max Physical Memory = {{ maxMemory }} MB
         </div>
       </b-form-group>
       <div>
-        <a
-          class="text-secondary action-link"
-          href="#"
-          @click.prevent="showConfiguration = false"
-        >
-          <i class="fa fa-times text-secondary" aria-hidden="true"></i>
-          Hide Settings</a
+        <b-link class="text-secondary" @click="showConfiguration = false">
+          <font-awesome-icon :icon="closeIcon" />
+          Hide Settings</b-link
         >
       </div>
     </div>
@@ -141,6 +137,13 @@ import Vue from "vue";
 import { BootstrapVue } from "bootstrap-vue";
 Vue.use(BootstrapVue);
 
+import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
+import { config, dom } from "@fortawesome/fontawesome-svg-core";
+import { faInfoCircle, faTimes } from "@fortawesome/free-solid-svg-icons";
+
+// Make sure you tell Font Awesome to skip auto-inserting CSS into the <head>
+config.autoAddCss = false;
+
 export default {
   props: {
     value: {
@@ -168,6 +171,22 @@ export default {
       required: true,
     },
   },
+  components: {
+    FontAwesomeIcon,
+  },
+  mounted() {
+    // Add font awesome styles
+    // https://github.com/FortAwesome/vue-fontawesome#web-components-with-vue-web-component-wrapper
+    const { shadowRoot } = this.$parent.$options;
+    const id = "fa-styles";
+
+    if (!shadowRoot.getElementById(`${id}`)) {
+      const faStyles = document.createElement("style");
+      faStyles.setAttribute("id", id);
+      faStyles.textContent = dom.css();
+      shadowRoot.appendChild(faStyles);
+    }
+  },
   data() {
     return {
       computationalResourceScheduling: this.cloneValue(),
@@ -201,6 +220,12 @@ export default {
     queueDescription() {
       return this.queue ? this.queue.queueDescription : null;
     },
+    closeIcon() {
+      return faTimes;
+    },
+    infoIcon() {
+      return faInfoCircle;
+    }
   },
   methods: {
     cloneValue() {
diff --git a/django_airavata/apps/workspace/yarn.lock b/django_airavata/apps/workspace/yarn.lock
index 2407517..f8e3826 100644
--- a/django_airavata/apps/workspace/yarn.lock
+++ b/django_airavata/apps/workspace/yarn.lock
@@ -682,11 +682,35 @@
     lodash "^4.17.13"
     to-fast-properties "^2.0.0"
 
+"@fortawesome/fontawesome-common-types@^0.2.35":
+  version "0.2.35"
+  resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz#01dd3d054da07a00b764d78748df20daf2b317e9"
+  integrity sha512-IHUfxSEDS9dDGqYwIW7wTN6tn/O8E0n5PcAHz9cAaBoZw6UpG20IG/YM3NNLaGPwPqgjBAFjIURzqoQs3rrtuw==
+
 "@fortawesome/fontawesome-free@^5.6.3":
   version "5.11.2"
   resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.11.2.tgz#8644bc25b19475779a7b7c1fc104bc0a794f4465"
   integrity sha512-XiUPoS79r1G7PcpnNtq85TJ7inJWe0v+b5oZJZKb0pGHNIV6+UiNeQWiFGmuQ0aj7GEhnD/v9iqxIsjuRKtEnQ==
 
+"@fortawesome/fontawesome-svg-core@^1.2.35":
+  version "1.2.35"
+  resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.35.tgz#85aea8c25645fcec88d35f2eb1045c38d3e65cff"
+  integrity sha512-uLEXifXIL7hnh2sNZQrIJWNol7cTVIzwI+4qcBIq9QWaZqUblm0IDrtSqbNg+3SQf8SMGHkiSigD++rHmCHjBg==
+  dependencies:
+    "@fortawesome/fontawesome-common-types" "^0.2.35"
+
+"@fortawesome/free-solid-svg-icons@^5.15.3":
+  version "5.15.3"
+  resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.3.tgz#52eebe354f60dc77e0bde934ffc5c75ffd04f9d8"
+  integrity sha512-XPeeu1IlGYqz4VWGRAT5ukNMd4VHUEEJ7ysZ7pSSgaEtNvSo+FLurybGJVmiqkQdK50OkSja2bfZXOeyMGRD8Q==
+  dependencies:
+    "@fortawesome/fontawesome-common-types" "^0.2.35"
+
+"@fortawesome/vue-fontawesome@^2.0.2":
+  version "2.0.2"
+  resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-2.0.2.tgz#5b86cd2fb7b4c17e5dede722c1c2855c97eceaea"
+  integrity sha512-ecpKSBUWXsxRJVi/dbOds4tkKwEcBQ1JSDZFzE2jTFpF8xIh3OgTX8POIor6bOltjibr3cdEyvnDjecMwUmxhQ==
+
 "@hapi/address@2.x.x":
   version "2.1.4"
   resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"

[airavata-django-portal] 01/03: AIRAVATA-3453 Apply GRP policy when it loads/changes

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9d3a3db0107df156dba5924d9c65aa8602eb6ebf
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu May 13 16:30:56 2021 -0400

    AIRAVATA-3453 Apply GRP policy when it loads/changes
---
 .../GroupResourceProfileSelector.vue               |   5 +
 .../js/web-components/ResourceSelectionEditor.vue  | 107 +++++++++++++++------
 2 files changed, 83 insertions(+), 29 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/GroupResourceProfileSelector.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/GroupResourceProfileSelector.vue
index 78be81f..9fd33c0 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/GroupResourceProfileSelector.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/GroupResourceProfileSelector.vue
@@ -104,6 +104,11 @@ export default {
       );
     },
   },
+  watch: {
+    value() {
+      this.groupResourceProfileId = this.value;
+    },
+  },
 };
 </script>
 
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue
index f45c133..5aea35a 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue
@@ -34,6 +34,7 @@ import {
   getAppDeploymentQueues,
   getApplicationDeployments,
   getDefaultComputeResourceId,
+  getDefaultGroupResourceProfileId,
   getGroupResourceProfile,
 } from "./store";
 export default {
@@ -53,7 +54,6 @@ export default {
       applicationDeployments: [],
       appDeploymentQueues: [],
       groupResourceProfile: null,
-      defaultComputeResourceId: null,
     };
   },
   computed: {
@@ -178,17 +178,22 @@ export default {
     async updateGroupResourceProfileId(event) {
       const [groupResourceProfileId] = event.detail;
       this.userConfigurationData.groupResourceProfileId = groupResourceProfileId;
-      this.emitValueChanged();
       await this.loadGroupResourceProfile();
       await this.loadApplicationDeployments();
-      // allowed queues may have changed
-      // TODO: reapply batchQueueResourcePolicy if batchQueueResourcePolicy
+      await this.applyGroupResourceProfile();
+      this.emitValueChanged();
     },
-    updateComputeResourceHostId(event) {
+    async updateComputeResourceHostId(event) {
       const [computeResourceHostId] = event.detail;
-      this.userConfigurationData.computationalResourceScheduling.resourceHostId = computeResourceHostId;
-      this.emitValueChanged();
-      this.loadAppDeploymentQueues();
+      if (
+        this.userConfigurationData.computationalResourceScheduling
+          .resourceHostId !== computeResourceHostId
+      ) {
+        this.userConfigurationData.computationalResourceScheduling.resourceHostId = computeResourceHostId;
+        await this.loadAppDeploymentQueues();
+        this.setDefaultQueue();
+        this.emitValueChanged();
+      }
     },
     updateComputationalResourceScheduling(event) {
       const [computationalResourceScheduling] = event.detail;
@@ -205,25 +210,45 @@ export default {
         this.applicationModuleId,
         this.groupResourceProfileId
       );
+    },
+    async initializeGroupResourceProfileId() {
+      this.userConfigurationData.groupResourceProfileId = await getDefaultGroupResourceProfileId();
+    },
+    async applyGroupResourceProfile() {
       // Make sure that resource host id is in the list of app deployments
-      this.initializeResourceHostId();
+      const computeResourceChanged = await this.initializeResourceHostId();
+      if (computeResourceChanged) {
+        await this.loadAppDeploymentQueues();
+        this.setDefaultQueue();
+      } else if (!this.queue) {
+        // allowed queues may have changed. If selected queue isn't in the list
+        // of allowed queues, reset to the default
+        this.setDefaultQueue();
+      } else {
+        // reapply batchQueueResourcePolicy maximums since they may have changed
+        this.applyBatchQueueResourcePolicy();
+      }
     },
-    initializeResourceHostId() {
+    async initializeResourceHostId() {
       // if there isn't a selected compute resource or there is but it isn't in
       // the list of app deployments, set a default one
+      // Returns true if the resourceHostId changed
       if (
         !this.resourceHostId ||
         !this.computeResources.find((crid) => crid === this.resourceHostId)
       ) {
-        this.userConfigurationData.computationalResourceScheduling.resourceHostId = this.getDefaultResourceHostId();
-        this.emitValueChanged();
+        this.userConfigurationData.computationalResourceScheduling.resourceHostId = await this.getDefaultResourceHostId();
+        return true;
       }
+      return false;
     },
     async loadAppDeploymentQueues() {
       const applicationDeployment = this.applicationDeployment;
       this.appDeploymentQueues = await getAppDeploymentQueues(
         applicationDeployment.appDeploymentId
       );
+    },
+    setDefaultQueue() {
       // set to the default queue or the first one
       const defaultQueue = this.getDefaultQueue();
       if (defaultQueue) {
@@ -248,9 +273,7 @@ export default {
         crs.totalCPUCount = this.getDefaultCPUCount(queue);
         crs.nodeCount = this.getDefaultNodeCount(queue);
         crs.wallTimeLimit = this.getDefaultWalltime(queue);
-        if (this.maxMemory === 0) {
-          crs.totalPhysicalMemory = 0;
-        }
+        crs.totalPhysicalMemory = 0;
       } else {
         const crs = this.userConfigurationData.computationalResourceScheduling;
         crs.queueName = null;
@@ -259,7 +282,6 @@ export default {
         crs.wallTimeLimit = 0;
         crs.totalPhysicalMemory = 0;
       }
-      this.emitValueChanged();
     },
     getDefaultQueue() {
       const defaultQueue = this.queues.find((q) => q.isDefaultQueue);
@@ -301,32 +323,58 @@ export default {
       }
       return queue.defaultWalltime;
     },
+    applyBatchQueueResourcePolicy() {
+      if (this.batchQueueResourcePolicy) {
+        const crs = this.userConfigurationData.computationalResourceScheduling;
+        crs.totalCPUCount = Math.min(
+          crs.totalCPUCount,
+          this.batchQueueResourcePolicy.maxAllowedCores
+        );
+        crs.nodeCount = Math.min(
+          crs.nodeCount,
+          this.batchQueueResourcePolicy.maxAllowedNodes
+        );
+        crs.wallTimeLimit = Math.min(
+          crs.wallTimeLimit,
+          this.batchQueueResourcePolicy.maxAllowedWalltime
+        );
+      }
+    },
     cloneValue() {
       return this.value ? this.value.clone() : null;
     },
     async loadData() {
       if (this.groupResourceProfileId) {
-        this.loadGroupResourceProfile();
-        this.loadApplicationDeployments();
+        // TODO: handle user no longer has access to GRP
+        await this.loadGroupResourceProfile();
+        await this.loadApplicationDeployments();
+        await this.loadAppDeploymentQueues();
+        await this.applyGroupResourceProfile();
+        // If existing values are no longer selectable, the userConfigurationData
+        // may have changed
+        this.emitValueChanged();
+      } else {
+        await this.initializeGroupResourceProfileId();
+        if (this.groupResourceProfileId) {
+          await this.loadGroupResourceProfile();
+          await this.loadApplicationDeployments();
+          await this.applyGroupResourceProfile();
+          this.emitValueChanged();
+        }
       }
-      this.loadDefaultComputeResourceId();
-    },
-    async loadDefaultComputeResourceId() {
-      this.defaultComputeResourceId = await getDefaultComputeResourceId();
     },
     async loadGroupResourceProfile() {
       this.groupResourceProfile = await getGroupResourceProfile(
         this.groupResourceProfileId
       );
     },
-    getDefaultResourceHostId() {
+    async getDefaultResourceHostId() {
+      const defaultComputeResourceId = await getDefaultComputeResourceId();
       if (
-        this.defaultComputeResourceId &&
-        this.computeResources.find(
-          (crid) => crid === this.defaultComputeResourceId
-        )
+        defaultComputeResourceId &&
+        this.computeResources.find((crid) => crid === defaultComputeResourceId)
       ) {
-        return this.defaultComputeResourceId;
+        return defaultComputeResourceId;
       } else if (this.computeResources.length > 0) {
         // Just pick the first one
         return this.computeResources[0];
@@ -350,7 +398,8 @@ export default {
     },
     computeResources: "bindWebComponentProps",
     resourceHostId: "bindWebComponentProps",
-    queueName: "bindWebComponentProps",
+    "userConfigurationData.computationalResourceScheduling":
+      "bindWebComponentProps",
     queues: "bindWebComponentProps",
   },
 };

[airavata-django-portal] 02/03: AIRAVATA-3453 Handle user no longer has access to GRP

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 25293ca04a7012eb2bdc0e9e5a9ff4d115296c90
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu May 13 16:31:35 2021 -0400

    AIRAVATA-3453 Handle user no longer has access to GRP
---
 .../js/web-components/ResourceSelectionEditor.vue  | 23 ++++++++++++++--------
 .../js/web-components/store.js                     | 19 +++++++++++++++---
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue
index 5aea35a..1cf0426 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/ResourceSelectionEditor.vue
@@ -345,14 +345,20 @@ export default {
     },
     async loadData() {
       if (this.groupResourceProfileId) {
-        // TODO: handle user no longer has access to GRP
-        await this.loadGroupResourceProfile();
-        await this.loadApplicationDeployments();
-        await this.loadAppDeploymentQueues();
-        await this.applyGroupResourceProfile();
-        // If existing values are no longer selectable, the userConfigurationData
-        // may have changed
-        this.emitValueChanged();
+        let groupResourceProfile = await this.loadGroupResourceProfile();
+        // handle user no longer has access to GRP
+        if (!groupResourceProfile) {
+          await this.initializeGroupResourceProfileId();
+          groupResourceProfile = await this.loadGroupResourceProfile();
+        }
+        if (groupResourceProfile) {
+          await this.loadApplicationDeployments();
+          await this.loadAppDeploymentQueues();
+          await this.applyGroupResourceProfile();
+          // If existing values are no longer selectable, the userConfigurationData
+          // may have changed
+          this.emitValueChanged();
+        }
       } else {
         await this.initializeGroupResourceProfileId();
         if (this.groupResourceProfileId) {
@@ -367,6 +373,7 @@ export default {
       this.groupResourceProfile = await getGroupResourceProfile(
         this.groupResourceProfileId
       );
+      return this.groupResourceProfile;
     },
     async getDefaultResourceHostId() {
       const defaultComputeResourceId = await getDefaultComputeResourceId();
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js
index dbf9818..5007bdf 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/store.js
@@ -70,9 +70,22 @@ export async function getGroupResourceProfiles() {
 }
 
 export async function getGroupResourceProfile(groupResourceProfileId) {
-  return await services.GroupResourceProfileService.retrieve({
-    lookup: groupResourceProfileId,
-  });
+  return await services.GroupResourceProfileService.retrieve(
+    {
+      lookup: groupResourceProfileId,
+    },
+    { ignoreErrors: true }
+  )
+    .catch((error) => {
+      // Ignore unauthorized errors, force user to pick a different GroupResourceProfile
+      if (!errors.ErrorUtils.isUnauthorizedError(error)) {
+        return Promise.reject(error);
+      } else {
+        return Promise.resolve(null);
+      }
+    })
+    // Report all other error types
+    .catch(utils.FetchUtils.reportError);
 }
 
 export async function getApplicationDeployments(