Skip to content

Commit

Permalink
bump version and update Node.js requirement to v23 or higher in packa…
Browse files Browse the repository at this point in the history
…ge.json
  • Loading branch information
stevenweaver committed Nov 23, 2024
1 parent 62f227c commit 21837d4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 34 deletions.
56 changes: 36 additions & 20 deletions lib/hpcsocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,47 @@ HPCSocket.prototype.initializeServer = function (url_input, callback) {

// Routine status update
self.server_socket.on("status update", function (data) {
// Update document with status update
self.job.analysis.status = data.phase;
self.job.analysis.last_status_msg = data.msg;
self.job.analysis.creation_time = data.ctime || self.job.analysis.created;
self.job.analysis.start_time = data.stime || self.job.analysis.start_time;
self.job.analysis.torque_id = data.torque_id;
// Update document fields with status update
self.job.analysis.status = data.phase;
self.job.analysis.last_status_msg = data.msg;
self.job.analysis.creation_time = data.ctime || self.job.analysis.created;
self.job.analysis.start_time = data.stime || self.job.analysis.start_time;
self.job.analysis.torque_id = data.torque_id;

// Use a flag to ensure save operations do not overlap
if (self.job.analysis._isSaving) {
winston.info("Save in progress. Skipping this update.");
return; // Skip if a save is already in progress
}

//Update the status for the analysis
self.job.analysis.save(function (err, result) {
if (err) throw err;
self.job.analysis._isSaving = true; // Mark as saving

var redis_packet = {
type: "status update",
msg: data.msg,
phase: data.phase,
torque_id: result.torque_id,
start_time: result.start_time,
creation_time: result.creation_time,
percentage: result.percentage_complete,
};
// Save the document
self.job.analysis.save(function (err, result) {
self.job.analysis._isSaving = false; // Reset the saving flag

publisher.publish(self.channel, JSON.stringify(redis_packet));
});
if (err) {
winston.warn("Error saving analysis:", err);
return;
}

// Prepare the redis packet
const redis_packet = {
type: "status update",
msg: data.msg,
phase: data.phase,
torque_id: result.torque_id,
start_time: result.start_time,
creation_time: result.creation_time,
percentage: result.percentage_complete,
};

// Publish the status update to the Redis channel
publisher.publish(self.channel, JSON.stringify(redis_packet));
});
});


// Routine status update
self.server_socket.on("job created", function (data) {
// Update document with status update
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datamonkey.js",
"version": "1.11.6",
"version": "1.12.0",
"description": "A free public server for comparative analysis of sequence alignments using state-of-the-art statistical models.",
"private": true,
"author": {
Expand All @@ -15,6 +15,9 @@
"format": "prettier 'src/**/*.{js,jsx}' 'app/**/*.{js,jsx}' 'lib/**/*.{js,jsx}' 'config/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --write",
"precommit": "pretty-quick --staged"
},
"engines": {
"node": ">=23.0.0"
},
"repository": {
"type": "git",
"url": "git://github.com/veg/datamonkey-js.git"
Expand Down
14 changes: 1 addition & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6774,11 +6774,6 @@ expand-range@^1.8.1:
dependencies:
fill-range "^2.1.0"

export-to-csv@^0.2.1:
version "0.2.2"
resolved "https://registry.yarnpkg.com/export-to-csv/-/export-to-csv-0.2.2.tgz#201ee08453dfb0d07792ee5e01fda48e4ff472ce"
integrity sha512-KHExLOjF2yvo8JU8Sv+5RuJAHzP1TpFvUgnWn8ex7zBrv1ZsABJAOpvG1RNRRWr1spYpDJmBBaR5/cV/8aBQSw==

export-to-csv@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/export-to-csv/-/export-to-csv-1.4.0.tgz#03fb42a4a4262cd03bde57a7b9bcad115149cf4b"
Expand Down Expand Up @@ -9612,12 +9607,6 @@ locate-path@^7.1.0:
dependencies:
p-locate "^6.0.0"

lodash-es@^4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==


lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
Expand Down Expand Up @@ -10208,8 +10197,7 @@ module-deps@^6.2.3:
through2 "^2.0.0"
xtend "^4.0.0"


moment@^2.30.1:
moment@^2.29.4, moment@^2.30.1:
version "2.30.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
Expand Down

0 comments on commit 21837d4

Please sign in to comment.