-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw an error if no worker machines available on execute. Closes #1054…
… (#1055) * WIP #1054 Added execution env check to plugins * WIP #1054 added check for execution workers on execute plugin start * WIP #1054 minor adjustment to log msg * WIP #1054 updated webgme-fab dep * WIP #1054 updated tests
- Loading branch information
Showing
8 changed files
with
4,574 additions
and
1,694 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* globals define */ | ||
define([ | ||
'superagent', | ||
'q' | ||
], function( | ||
superagent, | ||
Q | ||
) { | ||
const WORKER_ENDPOINT = '/rest/executor/worker'; | ||
const JOBS_ENDPOINT = '/rest/executor'; | ||
const values = dict => Object.keys(dict).map(k => dict[k]); | ||
|
||
const ExecutionEnv = {}; | ||
|
||
ExecutionEnv.url = function(urlPath) { | ||
if (typeof window === 'undefined') { | ||
let gmeConfig = require('../../config'); | ||
return `http://127.0.0.1:${gmeConfig.server.port}${urlPath}`; | ||
} | ||
return urlPath; | ||
}; | ||
|
||
ExecutionEnv.get = function(urlPath) { | ||
const deferred = Q.defer(); | ||
const url = this.url(urlPath); | ||
|
||
superagent.get(url) | ||
.end((err, res) => { | ||
if (err) { | ||
return deferred.reject(err); | ||
} | ||
deferred.resolve(JSON.parse(res.text)); | ||
}); | ||
|
||
return deferred.promise; | ||
}; | ||
|
||
ExecutionEnv.getWorkers = function() { | ||
return this.get(WORKER_ENDPOINT) | ||
.then(workerDict => values(workerDict)); | ||
}; | ||
|
||
ExecutionEnv.getJobs = function() { | ||
return this.get(JOBS_ENDPOINT); | ||
}; | ||
|
||
return ExecutionEnv; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters