Skip to content

Commit

Permalink
Merge tag 'v2.8.5' of https://github.com/genepi/cloudgene into releas…
Browse files Browse the repository at this point in the history
…e-2.8.5-tis
  • Loading branch information
abought committed Apr 19, 2024
2 parents af3e577 + a8ded7a commit bbcf49c
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cloudgene</groupId>
<artifactId>cloudgene</artifactId>
<version>2.8.2</version>
<version>2.8.5</version>

<name>Cloudgene</name>
<url>http://www.cloudgene.io</url>
Expand Down
6 changes: 3 additions & 3 deletions src/main/html/webapp/components/core/job/detail/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default Control.extend({
'#delete-btn click': function(el, ev) {
var that = this;

bootbox.confirm("Are you sure you want to delete <b>" + that.job.attr('id') + "</b>?", function(result) {
bootbox.confirm("Are you sure you want to delete <b>" + that.job.attr('name') + "</b>?", function(result) {
if (result) {

var okButton = $("button[data-bb-handler='confirm']");
Expand Down Expand Up @@ -106,7 +106,7 @@ export default Control.extend({
'#cancel-btn click': function(el, ev) {
var that = this;

bootbox.confirm("Are you sure you want to cancel <b>" + that.job.attr('id') + "</b>?", function(result) {
bootbox.confirm("Are you sure you want to cancel <b>" + that.job.attr('name') + "</b>?", function(result) {
if (result) {

var okButton = $("button[data-bb-handler='confirm']");
Expand Down Expand Up @@ -136,7 +136,7 @@ export default Control.extend({
'#restart-btn click': function(el, ev) {
var that = this;

bootbox.confirm("Are you sure you want to restart <b>" + that.job.attr('id') + "</b>?", function(result) {
bootbox.confirm("Are you sure you want to restart <b>" + that.job.attr('name') + "</b>?", function(result) {
if (result) {

var okButton = $("button[data-bb-handler='confirm']");
Expand Down
4 changes: 2 additions & 2 deletions src/main/html/webapp/components/core/job/list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default Control.extend({
var card = $(el).closest('.card');
var job = domData.get.call(card[0], 'job');

bootbox.confirm("Are you sure you want to delete <b>" + job.attr('id') + "</b>?", function(result) {
bootbox.confirm("Are you sure you want to delete <b>" + job.attr('name') + "</b>?", function(result) {
if (result) {

var okButton = $("button[data-bb-handler='confirm']");
Expand Down Expand Up @@ -78,7 +78,7 @@ export default Control.extend({
var card = $(el).closest('.card');
var job = domData.get.call(card[0], 'job');

bootbox.confirm("Are you sure you want to cancel <b>" + job.attr('id') + "</b>?", function(result) {
bootbox.confirm("Are you sure you want to cancel <b>" + job.attr('name') + "</b>?", function(result) {
if (result) {

var okButton = $("button[data-bb-handler='confirm']");
Expand Down
4 changes: 2 additions & 2 deletions src/main/html/webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/html/webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudgene",
"version": "2.8.2",
"version": "2.8.5",
"description": "Cloudgene web client",
"homepage": "http://www.cloudgene.io",
"author": "Lukas Forer <[email protected] (http://www.forer.it)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cloudgene/mapred/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

public class Main {

public static final String VERSION = "2.8.2";
public static final String VERSION = "2.8.5";

private Database database;

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cloudgene/mapred/api/v2/admin/ArchiveJob.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cloudgene.mapred.api.v2.admin;

import cloudgene.mapred.database.ParameterDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.restlet.data.Parameter;
import org.restlet.data.Status;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.Vector;

import cloudgene.mapred.database.ParameterDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.restlet.data.MediaType;
Expand Down
22 changes: 13 additions & 9 deletions src/main/java/cloudgene/mapred/api/v2/server/GetCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Map;

import cloudgene.mapred.database.JobDao;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
Expand All @@ -17,36 +18,39 @@ public class GetCounter extends BaseResource {
public Representation get() {

JSONObject jsonCounters = new JSONObject();

// complete
Map<String, Long> counters = getWorkflowEngine().getCounters(
AbstractJob.STATE_SUCCESS);
JSONObject jsonComplete = new JSONObject();
AbstractJob.STATE_SUCCESS);
JSONObject jsonComplete = new JSONObject();
for (String key : counters.keySet()) {
jsonComplete.put(key, counters.get(key));
}
jsonCounters.put("complete", jsonComplete);

// running
counters = getWorkflowEngine().getCounters(AbstractJob.STATE_RUNNING);
JSONObject jsonRunning = new JSONObject();
JSONObject jsonRunning = new JSONObject();
for (String key : counters.keySet()) {
jsonRunning.put(key, counters.get(key));
}
jsonCounters.put("running", jsonRunning);

// waiting
counters = getWorkflowEngine().getCounters(AbstractJob.STATE_WAITING);
JSONObject jsonWaiting= new JSONObject();
JSONObject jsonWaiting= new JSONObject();
for (String key : counters.keySet()) {
jsonWaiting.put(key, counters.get(key));
}
jsonCounters.put("waiting", jsonWaiting);

UserDao dao = new UserDao(getDatabase());
jsonCounters.put("users", dao.findAll().size());


UserDao dao = new UserDao(getDatabase());
jsonCounters.put("users", dao.countAll());

JSONObject queue = new JSONObject();
queue.put("size", getWorkflowEngine().getSize());
jsonCounters.put("queue", queue);

return new StringRepresentation(jsonCounters.toString());

}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cloudgene/mapred/cron/CleanUpTasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.util.List;

import cloudgene.mapred.database.ParameterDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

Expand Down Expand Up @@ -53,6 +54,7 @@ public static int executeRetire(Database database, Settings settings) {
job.setState(AbstractJob.STATE_RETIRED);
dao.update(job);


log.info("Job " + job.getId() + " retired.");
deleted++;

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/cloudgene/mapred/database/JobDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,31 @@ public List<AbstractJob> findAllByState(int state) {
}
}

@SuppressWarnings("unchecked")
public int countAllByState(int state) {

StringBuilder sql = new StringBuilder();
sql.append("select count(*) ");
sql.append("from job ");
sql.append("where state = ? ");

Object[] params = new Object[1];
params[0] = state;

int result = 0;

try {
result = (Integer) queryForObject(sql.toString(), params, new IntegerMapper());
log.debug("count all old jobs successful. results: " + result);

return result;
} catch (SQLException e) {
log.error("count all old jobs failed", e);
return 0;
}
}


public AbstractJob findById(String id) {

return findById(id, true);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cloudgene/mapred/database/ParameterDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public CloudgeneParameterOutput findById(int id) {
}
}

class ParameterInputMapper implements IRowMapper {
class ParameterInputMapper implements IRowMapper {

@Override
public Object mapRow(ResultSet rs, int row) throws SQLException {
Expand Down
23 changes: 22 additions & 1 deletion src/main/java/cloudgene/mapred/database/UserDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,28 @@ public List<User> findAll() {
}
return result;
}


@SuppressWarnings("unchecked")
public int countAll() {

StringBuilder sql = new StringBuilder();
sql.append("select count(*) ");
sql.append("from `user` ");

int result = 0;

try {
result = (Integer) queryForObject(sql.toString(), new IntegerMapper());
log.debug("count all users successful. results: " + result);

return result;
} catch (SQLException e) {
log.error("count all users failed", e);
return 0;
}
}


@SuppressWarnings("unchecked")
public List<User> findByQuery(String query) {

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/cloudgene/mapred/jobs/WorkflowEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ public List<AbstractJob> getAllJobsInLongTimeQueue() {
return jobs;
}

public int getSize() {
return longTimeQueue.getSize() + shortTimeQueue.getSize();
}

class SetupThread extends PriorityRunnable {

private AbstractJob job;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/cloudgene/mapred/jobs/queue/Queue.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ public boolean isInQueue(AbstractJob job) {
}
}

public int getSize() {
return queue.size();
}

protected class PriorityComparator implements Comparator<AbstractJob> {

@Override
Expand Down

0 comments on commit bbcf49c

Please sign in to comment.