Skip to content

Commit 36a7bd9

Browse files
Add support for Temporary volume pool in sciserver-files. Closes #1635. (#1636)
* Add support for Temporary volume pool in sciserver-files. Closes #1635. * WIP- change volume pool to Temporary for sciserver-files * WIP- Add volumePool in sciserver-compute upload files
1 parent d246983 commit 36a7bd9

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

src/common/compute/backends/sciserver-compute/Client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ define([
7272
username: this.username,
7373
password: this.password,
7474
volume: this.volume,
75+
volumePool: 'Storage'
7576
};
7677
const storage = await Storage.getClient('sciserver-files', this.logger, config);
7778
const files = Object.entries(metadata.content)

src/common/storage/backends/sciserver-files/Client.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ define([
1111
StorageClient.apply(this, arguments);
1212
this.username = config.username;
1313
this.password = config.password;
14+
this.volumePool = config.volumePool;
1415
this.volume = (config.volume || '').replace(/^Storage\//, '');
1516
};
1617

1718
SciServerFiles.prototype = Object.create(StorageClient.prototype);
1819

1920
SciServerFiles.prototype.getFile = async function (dataInfo) {
20-
const {volume, filename} = dataInfo.data;
21-
const url = `file/Storage/${volume}/${filename}`;
21+
let {volume, filename, volumePool} = dataInfo.data;
22+
const url = `file/${volumePool}/${volume}/${filename}`;
2223
const response = await this.fetch(url);
2324
if (require.isBrowser) {
2425
return await response.arrayBuffer();
@@ -37,7 +38,7 @@ define([
3738
body: content,
3839
};
3940

40-
const url = `file/Storage/${this.volume}/${filename}`;
41+
const url = `file/${this.volumePool}/${this.volume}/${filename}`;
4142
try{
4243
await this.fetch(url, opts);
4344
} catch (errRes) {
@@ -48,19 +49,20 @@ define([
4849
filename: filename,
4950
volume: this.volume,
5051
size: content.byteLength,
52+
volumePool: this.volumePool
5153
};
5254
return this.createDataInfo(metadata);
5355
};
5456

5557
SciServerFiles.prototype.deleteDir = async function (dirname) {
56-
const url = `data/Storage/${this.volume}/${dirname}`;
58+
const url = `data/${this.volumePool}/${this.volume}/${dirname}`;
5759
const opts = {method: 'DELETE'};
5860
return await this.fetch(url, opts);
5961
};
6062

6163
SciServerFiles.prototype.deleteFile = async function (dataInfo) {
6264
const {volume, filename} = dataInfo.data;
63-
const url = `data/Storage/${volume}/${filename}`;
65+
const url = `data/${this.volumePool}/${volume}/${filename}`;
6466
const opts = {method: 'DELETE'};
6567
return await this.fetch(url, opts);
6668
};

src/common/storage/backends/sciserver-files/metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
"value": "USERNAME/deepforge_data",
3030
"valueType": "string",
3131
"readOnly": false
32+
},
33+
{
34+
"name": "volumePool",
35+
"displayName": "Volume Pool",
36+
"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.",
37+
"value": "Storage",
38+
"valueItems": [
39+
"Storage",
40+
"Temporary"
41+
]
3242
}
3343
]
3444
}

test/assets/configs/storage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ function getSciServerFilesConfig() {
44
const username = getSciServerUsername();
55
const password = getSciServerPassword();
66
const volume = `${username}/deepforge_test`;
7+
const volumePool = 'Temporary';
78

8-
return {username, password, volume};
9+
return {username, password, volume, volumePool};
910
}
1011

1112
function getS3Config() {

0 commit comments

Comments
 (0)