Skip to content

Commit

Permalink
Use JS files instead of JSON for compute metadata. Close #2009 (#2010)
Browse files Browse the repository at this point in the history
* Use JS files instead of JSON for compute metadata. Close #2009

* Remove prepare file

* Update metadata loading in compute index

* Remove file ext

* Fix linting errors
  • Loading branch information
brollb authored Mar 23, 2021
1 parent 7ea3688 commit 7dbfa78
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 15 deletions.
9 changes: 9 additions & 0 deletions src/common/compute/backends/gme/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*globals define*/
define([], function() {
return {
name: 'WebGME Executor Framework',
dashboard: './dashboard/index',
client: './Client',
configStructure: []
};
});
6 changes: 0 additions & 6 deletions src/common/compute/backends/gme/metadata.json

This file was deleted.

9 changes: 9 additions & 0 deletions src/common/compute/backends/local/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*globals define*/
define([], function() {
return {
name: 'Server Execution',
dashboard: null,
client: './Client',
configStructure: []
};
});
6 changes: 0 additions & 6 deletions src/common/compute/backends/local/metadata.json

This file was deleted.

38 changes: 38 additions & 0 deletions src/common/compute/backends/sciserver-compute/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*globals define*/
define([
], function(
) {
return {
name: 'SciServer Compute',
dashboard: './dashboard/index',
configStructure: [
{
name: 'username',
displayName: 'Username',
description: 'SciServer username',
value: '',
valueType: 'stringX',
valueItemsURL: '/routers/SciServerAuth',
extraValueItems: [
{
name: 'Link account...',
type: 'URL',
value: 'https://apps.sciserver.org/login-portal/login?callbackUrl=<%= window.location.origin %>/routers/SciServerAuth/register'
}
],
readOnly: false,
isAuth: true
},
{
name: 'computeDomain',
displayName: 'Compute Domain',
description: 'A small job shares resources with up to 4 other jobs and has a max quota for RAM of approx 32GB. A large job runs exclusively and has all CPU cores and RAM available (approx 240GB), however since only one large job will run at a time, there may be a longer wait for the job to start.',
value: 'Small Jobs Domain',
valueItems: [
'Small Jobs Domain',
'Large Jobs Domain'
]
}
],
};
});
6 changes: 3 additions & 3 deletions src/common/compute/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/*globals define, requirejs */
(function() {
const COMPUTE_BACKENDS = ['gme', 'local', 'sciserver-compute'];
const metadataPath = name => `deepforge/compute/backends/${name}/metadata`;
define([
'module',
'deepforge/compute/backends/ComputeBackend',
].concat(COMPUTE_BACKENDS.map(name => `text!deepforge/compute/backends/${name}/metadata.json`)),
].concat(COMPUTE_BACKENDS.map(metadataPath)),
function(
module,
ComputeBackend,
Expand Down Expand Up @@ -44,8 +45,7 @@
throw new Error(`Compute backend not found: ${id}`);
}

const relativePath = `backends/${id}/metadata.json`;
const metadata = JSON.parse(requirejs(`text!deepforge/compute/${relativePath}`));
const metadata = requirejs(metadataPath(id));
metadata.id = id;
return metadata;
};
Expand Down

0 comments on commit 7dbfa78

Please sign in to comment.