diff --git a/src/common/compute/backends/sciserver-compute/Client.js b/src/common/compute/backends/sciserver-compute/Client.js index 3d7a5976f..9100cd6c9 100644 --- a/src/common/compute/backends/sciserver-compute/Client.js +++ b/src/common/compute/backends/sciserver-compute/Client.js @@ -72,6 +72,7 @@ define([ username: this.username, password: this.password, volume: this.volume, + volumePool: 'Storage' }; const storage = await Storage.getClient('sciserver-files', this.logger, config); const files = Object.entries(metadata.content) diff --git a/src/common/storage/backends/sciserver-files/Client.js b/src/common/storage/backends/sciserver-files/Client.js index f6e2cb52d..adc2e7ebb 100644 --- a/src/common/storage/backends/sciserver-files/Client.js +++ b/src/common/storage/backends/sciserver-files/Client.js @@ -11,14 +11,15 @@ define([ StorageClient.apply(this, arguments); this.username = config.username; this.password = config.password; + this.volumePool = config.volumePool; this.volume = (config.volume || '').replace(/^Storage\//, ''); }; SciServerFiles.prototype = Object.create(StorageClient.prototype); SciServerFiles.prototype.getFile = async function (dataInfo) { - const {volume, filename} = dataInfo.data; - const url = `file/Storage/${volume}/${filename}`; + let {volume, filename, volumePool} = dataInfo.data; + const url = `file/${volumePool}/${volume}/${filename}`; const response = await this.fetch(url); if (require.isBrowser) { return await response.arrayBuffer(); @@ -37,7 +38,7 @@ define([ body: content, }; - const url = `file/Storage/${this.volume}/${filename}`; + const url = `file/${this.volumePool}/${this.volume}/${filename}`; try{ await this.fetch(url, opts); } catch (errRes) { @@ -48,19 +49,20 @@ define([ filename: filename, volume: this.volume, size: content.byteLength, + volumePool: this.volumePool }; return this.createDataInfo(metadata); }; SciServerFiles.prototype.deleteDir = async function (dirname) { - const url = `data/Storage/${this.volume}/${dirname}`; + const url = `data/${this.volumePool}/${this.volume}/${dirname}`; const opts = {method: 'DELETE'}; return await this.fetch(url, opts); }; SciServerFiles.prototype.deleteFile = async function (dataInfo) { const {volume, filename} = dataInfo.data; - const url = `data/Storage/${volume}/${filename}`; + const url = `data/${this.volumePool}/${volume}/${filename}`; const opts = {method: 'DELETE'}; return await this.fetch(url, opts); }; diff --git a/src/common/storage/backends/sciserver-files/metadata.json b/src/common/storage/backends/sciserver-files/metadata.json index 624f1440c..e62794587 100644 --- a/src/common/storage/backends/sciserver-files/metadata.json +++ b/src/common/storage/backends/sciserver-files/metadata.json @@ -29,6 +29,16 @@ "value": "USERNAME/deepforge_data", "valueType": "string", "readOnly": false + }, + { + "name": "volumePool", + "displayName": "Volume Pool", + "description": "Folders and files in User Volumes under “Storage” will be backed up and permanent, but there is a quota limit of 10GB. Folders and files in User Volumes under “Temporary” are not backed up, and will be deleted after a particular time period.", + "value": "Storage", + "valueItems": [ + "Storage", + "Temporary" + ] } ] } diff --git a/test/assets/configs/storage.js b/test/assets/configs/storage.js index f413bfc75..7c54ec97d 100644 --- a/test/assets/configs/storage.js +++ b/test/assets/configs/storage.js @@ -4,8 +4,9 @@ function getSciServerFilesConfig() { const username = getSciServerUsername(); const password = getSciServerPassword(); const volume = `${username}/deepforge_test`; + const volumePool = 'Temporary'; - return {username, password, volume}; + return {username, password, volume, volumePool}; } function getS3Config() {