Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/compute/backends/sciserver-compute/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions src/common/storage/backends/sciserver-files/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand All @@ -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);
};
Expand Down
10 changes: 10 additions & 0 deletions src/common/storage/backends/sciserver-files/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
}
3 changes: 2 additions & 1 deletion test/assets/configs/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down