Commit 23096551 authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

fixed 72: should be a fresh copy of 62

parent f1c83bdb
{
"VERSION" : 0.01,
"Graph" : {
"Pad" : "1.0",
"Node" : {
"Font" : "Times-Roman",
"Colour" : "cyan",
"Table" : { "Colour" : "black", "Font" : "Courier" },
"Details" : { "Font" : "Helvetica" },
"JobStatus" : {
"SEMAPHORED" : { "Colour" : "#808080" },
"READY" : { "Colour" : "#00FF00" },
"INPROGRESS" : { "Colour" : "#FFFF00" },
"DONE" : { "Colour" : "#00BFFF" },
"FAILED" : { "Colour" : "#FF0000" }
},
"AnalysisStatus" : {
"EMPTY" : { "Colour" : "#FFFFFF" },
"BLOCKED" : { "Colour" : "#808080" },
"LOADING" : { "Colour" : "#00FF00" },
"ALL_CLAIMED" : { "Colour" : "#808080" },
"SYNCHING" : { "Colour" : "#00FF00" },
"READY" : { "Colour" : "#00FF00" },
"WORKING" : { "Colour" : "#FFFF00" },
"DONE" : { "Colour" : "#00BFFF" },
"FAILED" : { "Colour" : "#FF0000" }
}
},
"Edge" : {
"Font" : "Helvetica",
"Data" : { "Colour" : "blue" },
"Control" : { "Colour" : "red" },
"Semablock" : { "Colour" : "red" },
"Accu" : { "Colour" : "darkgreen" }
},
"Box" : {
"ColourScheme" : "blues9",
"ColourOffset" : 1
},
"DisplayStats" : "text",
"DisplayJobs" : 0,
"DisplayData" : 0,
"DisplayDetails" : 1,
"DisplayStretched" : 0,
"DisplaySemaphoreBoxes" : 1,
"DuplicateTables" : 0
}
}
......@@ -28,8 +28,10 @@
<!-- JS CODE -->
<!-- Remote JQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>-->
<!--<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>-->
<script src="/lib/jquery.min.js"></script>
<script src="/lib/jquery-ui.min.js"></script>
<!-- Local JQuery-URL-Parser -->
<script src="/lib/jQuery-URL-Parser/purl.js"></script>
......@@ -44,16 +46,19 @@
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<!-- Remote D3.js -->
<script src="http://d3js.org/d3.v3.min.js"></script>
<!--<script src="http://d3js.org/d3.v3.min.js"></script>-->
<script src="/lib/d3.v3.min.js"></script>
<!-- jEditable.js -->
<script src="http://www.appelsiini.net/download/jquery.jeditable.js"></script>
<!--<script src="http://www.appelsiini.net/download/jquery.jeditable.js"></script>-->
<script src="/lib/jquery.jeditable.js"></script>
<!-- Remote DataTables.js -->
<script src="http://datatables.net/download/build/jquery.dataTables.min.js"></script>
<!--<script src="http://datatables.net/download/build/jquery.dataTables.min.js"></script>-->
<script src="/lib/jquery.dataTables.min.js"></script>
<!-- DataTables -- column filters -->
<script src="http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/jquery.dataTables.columnFilter.js"></script>
<!-- DataTables - column filters -->
<script src="/lib/jquery.dataTables.columnFilter.js"></script>
<!-- Local javascripts -->
<script src="./javascript/node_color.js"></script>
......@@ -104,6 +109,7 @@
<li><a href="#main" data-toggle="tab">Diagram View</a></li>
<li><a href="#connection_summary" data-toggle="tab">Summary View</a></li>
<li><a href="#jobs" data-toggle="tab">Jobs</a></li>
<li><a href="#pipeline_wide_parameters" data-toggle="tab">Pipeline-wide parameters</a></li>
<li><a href="#resource_details" data-toggle="tab">Resources</a></li>
<li><a href="#views" data-toggle="tab">Bubbles View</a></li>
<li><a href="#logContainer" data-toggle="tab" id="log-tab">Log</a></li>
......@@ -150,6 +156,8 @@
<div id="jobs_table_div"></div>
</div>
<div id="pipeline_wide_parameters" class="tab-pane"></div>
<div id="resource_details" class="tab-pane"></div>
<div id="views" class="tab-pane">
......
......@@ -158,38 +158,6 @@ $(document).ready(function() {
// });
});
// function go_to_full_url () {
// var full_url = $("#db_url").val();
// $.ajax({
// url : "./scripts/url_parser.pl",
// type : "post",
// data : "url=" + full_url,
// dataType : "json",
// async : false,
// success : function(dbConn) {
// if (dbConn.status !== "FAILED") {
// console.log(dbConn.out_msg);
// var http_url = $.url();
// var new_http_url = "http://" + http_url.attr("host") + ":" + http_url.attr("port") + "/?username=" + dbConn.out_msg.user + "&host=" + dbConn.out_msg.host + "&dbname=" + dbConn.out_msg.dbname + "&port=" + dbConn.out_msg.port;
// if (dbConn.out_msg.passwd !== undefined && dbConn.out_msg.passwd !== '') {
// new_http_url = new_http_url + "&passwd=xxxxx";
// }
// window.location.href = new_http_url;
// } else {
// log(dbConn);
// }
// },
// error : function (x, t, m) {
// if(t==="timeout") {
// log({err_msg : "No response from mysql sever for 10s. Try it later"});
// $("#connection_msg").empty();
// } else {
// log({err_msg : m});
// }
// }
// });
// }
function guess_database_url () {
......@@ -364,6 +332,9 @@ function onSuccess_dbConnect(res) {
// Showing the resources
fetch_resources();
// And the pipeline-wide parameters
fetch_and_setup_change_listener( "scripts/db_fetch_pipeline_params.pl", "scripts/db_update_nonobject.pl", "#pipeline_wide_parameters" );
// We load the jobs form
$.get('./scripts/db_jobs_form.pl', {url : guiHive.pipeline_url, version : guiHive.version} ,function(data) {
$('#jobs_form').html(data);
......@@ -428,6 +399,188 @@ function onSuccess_fetchResources(resourcesRes, analysis_id, fetch_url) {
listen_Resources(fetch_url);
}
function fetch_and_setup_change_listener(fetch_url, write_url, target_div) {
var tooltip_onlyalpha = 'Only alpha-numeric characters and the underscore are allowed';
var tooltip_uniquename = 'Parameter names have to be unique';
var tooltip_nonempty = 'The parameter name must be defined'
// Replace the div with the output of fetch_url
function doFetch() {
$.ajax({
url : fetch_url,
type : "post",
data : "url=" + guiHive.pipeline_url + "&version=" + guiHive.version,
dataType : "json",
success : onFetchSuccess_handler,
error : function(resp,error) {log({err_msg : error})},
});
}
// Read the data objects and build the post data to send to write_url
function get_url_data(ref_object) {
var url_data = "url="+ guiHive.pipeline_url +
"&method="+$(ref_object).attr("data-method") +
"&version="+guiHive.version;
function add_links(name, f) {
if ($(ref_object).attr(name)) {
var blocks = $(ref_object).attr(name).split(",");
var vals = jQuery.map(blocks, function(e,i) {
var parts = e.split("=");
return parts[0] + "=" + f($('#'+parts[1])[0]);
});
return "&" + vals.join("&");
} else {
return "";
}
};
url_data = url_data + add_links('data-linkTo', function(o) {return o.value});
url_data = url_data + add_links('data-linkToDef', function(o) {return o.defaultValue});
return url_data
};
// Check that input_object has a valid key name (not empty, not duplicated, and alphanumeric only)
function key_check(d, input_object, check_empty) {
var new_tooltip = null;
var control_group = $(input_object).closest('.control-group');
if (check_empty && (input_object.value === "")) {
new_tooltip = tooltip_nonempty;
} else if ($(input_object).hasClass('onlyalpha') && !(input_object.value.match(/^[0-9a-zA-Z\_]*$/))) {
new_tooltip = tooltip_onlyalpha;
} else if ((input_object.value !== input_object.defaultValue) || control_group.hasClass("error")) {
jQuery.map(d.find("input[id^='pw_key_']").add(d.find("#p_new_key")), function(obj, i) {
var same_name = (obj.id !== input_object.id) && ((obj.value === input_object.value) || (obj.defaultValue === input_object.value));
$(obj).closest('.control-group').toggleClass('warning', same_name);
if (same_name) {
new_tooltip = tooltip_uniquename
}
});
}
var is_error = !!new_tooltip;
var tooltip_placeholder = $(input_object).closest('.input-append');
if (is_error) {
if (!tooltip_placeholder.data("tooltip") || (tooltip_placeholder.data("tooltip").options.title !== new_tooltip)) {
tooltip_placeholder.tooltip('destroy');
tooltip_placeholder.tooltip({title: new_tooltip});
tooltip_placeholder.tooltip('show');
}
} else {
tooltip_placeholder.tooltip('destroy');
}
control_group.toggleClass("error", is_error);
control_group.toggleClass("info", !is_error);
return is_error;
};
// Setup all the listeners
function onFetchSuccess_handler(resp) {
if (resp.status != "ok") {
log(resp);
return;
}
var d = $(target_div);
d.html(resp.out_msg);
d.find("input.monitored").map( function(i, monitored_input) {
var ref_object = $(monitored_input);
var control_group = ref_object.parent();
control_group.addClass('control-group');
var input_append_group = $('<div class="input-append"></div>');
input_append_group.appendTo(control_group);
ref_object.appendTo(input_append_group);
var controls_container = $('<div class="control_container"></div>');
input_append_group.append(controls_container);
var input_sender = $('<a class="btn btn-mini add-on"><i class="icon-ok"></i></a>');
controls_container.append(input_sender);
var input_restorer = $('<a class="btn btn-mini add-on"><i class="icon-refresh"></i></a>');
controls_container.append(input_restorer);
var targets = controls_container.children();
targets.hide();
$(monitored_input).keyup( function(evt) {
var is_change = (monitored_input.value !== monitored_input.defaultValue);
var is_valid_input = !key_check(d, this, true);
input_restorer.toggle(is_change);
input_sender.toggle(is_change && is_valid_input);
});
input_restorer.click( function(evt) {
monitored_input.value = monitored_input.defaultValue;
key_check(d, this, false);
targets.hide();
control_group.removeClass("success");
control_group.removeClass("info");
control_group.removeClass("error");
});
input_sender.click( function(evt) {
var url_data = get_url_data(monitored_input);
control_group.removeClass("info");
function success(updateRes) {
if (updateRes.status === "ok") {
monitored_input.defaultValue = monitored_input.value;
targets.hide();
control_group.addClass("success");
} else {
control_group.addClass("error");
log(updateRes);
};
};
onClick_handler(url_data, success, null);
});
});
d.find(".ajaxable_btn").click( function(evt) {
var url_data = get_url_data(this);
var o = $(this);
var refresh = true;
function success(updateRes) {
if (updateRes.status !== "ok") {
log(updateRes);
} else if (o.hasClass("remove_row")) {
o.closest("tr").remove();
refresh = false;
};
};
function complete() {
if (refresh) {
doFetch();
}
};
onClick_handler(url_data, success, complete);
});
d.find("#p_new_key").keyup( function(evt) {
var is_error = key_check(d, this, false);
$(this).closest("tr").find(".btn").toggleClass("disabled", (is_error || (this.value === "")))
});
};
function onClick_handler(url_data, fs, fc) {
$.ajax({
url : write_url,
type : "post",
data : url_data,
dataType : "json",
async : false,
cache : false,
success : fs,
complete : fc
});
}
doFetch();
}
function change_refresh_time() {
guiHive.monitorTimeout = $(this).val()
guiHive.refresh_data_timer.timer(guiHive.monitorTimeout/1000);
......@@ -752,6 +905,9 @@ function buildURL(obj) {
if ($(obj).attr("data-analysisID")) {
URL = URL.concat("&analysis_id="+$(obj).attr("data-analysisID"));
}
if ($(obj).attr("data-fields")) {
URL = URL.concat("&fields="+$(obj).attr("data-fields"));
}
return(URL);
}
......
......@@ -41,38 +41,20 @@ my $url = $var->{url}->[0];
my $analysis_id = $var->{analysis_id}->[0];
my $method = $var->{method}->[0];
my $adaptor_name = "AnalysisJob";
my $version = $var->{version}->[0];
my $project_dir = $ENV{GUIHIVE_BASEDIR} . "versions/$version/";
# Initialization
my $dbConn = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( -no_sql_schema_version_check => 1, -url => $url );
my $dbConn = check_db_versions_match($var);
my $response = msg->new();
if (defined $dbConn) {
## First check if the code version is OK
my $code_version = get_hive_code_version();
my $hive_db_version = get_hive_db_version($dbConn);
if ($code_version != $version) {
$response->status("VERSION MISMATCH");
$response->err_msg("$code_version $hive_db_version");
print $response->toJSON;
exit 0;
}
$adaptor_name = "get_".$adaptor_name."Adaptor";
my $adaptor = $dbConn->$adaptor_name;
eval {
$adaptor->$method($analysis_id);
};
$response->err_msg($@);
$response->status($response->err_msg) if ($@);
} else {
$response->err_msg("Error connecting to the database. Please try to connect again");
$response->status("FAILED");
}
if ($@) {
$response->err_msg($@);
$response->status('FAILED');
}
print $response->toJSON();
......@@ -35,67 +35,27 @@ use msg;
use version_check;
my $json_url = shift @ARGV || '{"version":["53"],"url":["mysql://ensro@127.0.0.1:2912/mp12_compara_nctrees_74clean2"]}';
my $hive_config_file = $ENV{GUIHIVE_BASEDIR} . "config/hive_config.json";
my $hive_config_file = $ENV{EHIVE_ROOT_DIR} . "/../config/hive_config.json";
# Input data
my $url = decode_json($json_url)->{url}->[0];
my $version = decode_json($json_url)->{version}->[0];
my $decoded_json = decode_json($json_url);
# Set up @INC and paths for static content
my $project_dir = $ENV{GUIHIVE_BASEDIR} . "versions/$version/";
my $connection_template = "${project_dir}static/connection_details.html";
my $connection_template = $ENV{GUIHIVE_BASEDIR} . "static/connection_details.html";
my $response = msg->new();
my $dbConn = check_db_versions_match($decoded_json);
$dbConn->load_collections();
# Initialization
my $dbConn;
eval {
$dbConn = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( -no_sql_schema_version_check => 1, -url => $url );
my $graph = formAnalyses($dbConn);
my $html = formResponse($dbConn);
$response->out_msg({"graph" => $graph, "html" => $html});
};
if ($@) {
$response->err_msg($@);
$response->status("FAILED");
print $response->toJSON;
exit(0);
}
if (defined $dbConn) {
## Check if the code version is OK
my $code_version = get_hive_code_version();
my $hive_db_version;
eval {
$hive_db_version = get_hive_db_version($dbConn);
};
if ($@) {
$response->err_msg($@);
$response->status("FAILED");
print $response->toJSON;
exit(0);
}
if ($code_version != $hive_db_version) {
$response->status("VERSION MISMATCH");
$response->err_msg("$code_version $hive_db_version");
print $response->toJSON;
exit 0;
}
$dbConn->load_collections();
my ($graph, $html);
eval {
$graph = formAnalyses($dbConn);
$html = formResponse($dbConn);
};
if ($@) {
$response->err_msg("I have problems retrieving data from the database:$@");
$response->status("FAILED");
} else {
$response->out_msg({"graph" => $graph,
"html" => $html});
}
} else {
$response->err_msg("The provided URL seems to be invalid. Please check the URL and try again\n") unless($response->err_msg);
$response->err_msg("I have problems retrieving data from the database:$@");
$response->status("FAILED");
}
......@@ -112,9 +72,9 @@ sub formResponse {
$info->{username} = $dbConn->dbc->username;
$info->{hive_db_version} = get_hive_db_version($dbConn);
$info->{hive_code_version} = get_hive_code_version();
$info->{pipeline_name} = get_hive_pipeline_name($dbConn);
$info->{hive_auto_rebalance_semaphores} = get_hive_auto_rebalance_semaphores($dbConn) ? 'Enabled' : 'Disabled';
$info->{hive_use_param_stack} = get_hive_use_param_stack($dbConn) ? 'Enabled' : 'Disabled';
$info->{pipeline_name} = get_hive_db_meta_key($dbConn, 'hive_pipeline_name');
$info->{hive_auto_rebalance_semaphores} = get_hive_db_meta_key($dbConn, 'hive_auto_rebalance_semaphores') ? 'Enabled' : 'Disabled';
$info->{hive_use_param_stack} = get_hive_db_meta_key($dbConn, 'hive_use_param_stack') ? 'Enabled' : 'Disabled';
my $template = HTML::Template->new(filename => $connection_template);
$template->param(%$info);
......
......@@ -40,29 +40,14 @@ my $url = $var->{url}->[0];
my $args = $var->{args}->[0];
my $adaptor_name = $var->{adaptor}->[0];
my $method = $var->{method}->[0];
my $version = $var->{version}->[0];
my $project_dir = $ENV{GUIHIVE_BASEDIR} . "versions/$version/";
my @args = split(/,/,$args);
my $dbConn = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( -no_sql_schema_version_check => 1, -url => $url );
# Initialization
my $dbConn = check_db_versions_match($var);
my $response = msg->new();
if (defined $dbConn) {
## First check if the code version is OK
my $code_version = get_hive_code_version();
my $hive_db_version = get_hive_db_version($dbConn);
if ($code_version != $version) {
$response->status("VERSION MISMATCH");
$response->err_msg("$code_version $hive_db_version");
print $response->toJSON;
exit 0;
}
$adaptor_name = "get_".$adaptor_name."Adaptor";
my $adaptor = $dbConn->$adaptor_name;
......@@ -70,12 +55,10 @@ if (defined $dbConn) {
$adaptor->$method(@args);
# $adaptor->update($obj);
};
$response->err_msg($@);
$response->status($response->err_msg) if ($@);
} else {
$response->err_msg("Error connecting to the database. Please try to connect again");
$response->status("FAILED");
}
if ($@) {
$response->err_msg($@);
$response->status('FAILED');
}
print $response->toJSON();
......@@ -37,30 +37,13 @@ use version_check;
my $json_data = shift @ARGV || '{"version":["62"],"url":["mysql://ensro@mysql-e-farm-test56.ebi.ac.uk:4449/ayates_fastq_align_run2"]}';
my $var = decode_json($json_data);
my $url = $var->{url}->[0];
my $version = $var->{version}->[0];
my $project_dir = $ENV{GUIHIVE_BASEDIR} . "versions/$version/";
my $dbConn = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( -no_sql_schema_version_check => 1, -url => $url );
my $dbConn = check_db_versions_match($var);
my $response = msg->new();
my $stats_table_has_data = 0;
if (defined $dbConn) {
## First check if the code version is OK
my $code_version = get_hive_code_version();
my $hive_db_version = get_hive_db_version($dbConn);
if ($code_version != $version) {
$response->status("VERSION MISMATCH");
$response->err_msg("$code_version $hive_db_version");
print $response->toJSON;
exit 0;
}
my $all_analysis;
eval {
$all_analysis = $dbConn->get_AnalysisAdaptor()->fetch_all();
......@@ -73,9 +56,6 @@ if (defined $dbConn) {
$stats_table_has_data = stats_table_is_not_empty($dbConn->dbc->dbname);
$response->out_msg(formAnalysisInfo($all_analysis));
} else {
$response->err_msg("The provided URL seems to be invalid. Please check the URL and try again");
}
print $response->toJSON;
......
......@@ -38,30 +38,15 @@ my $json_data = shift @ARGV || '{"version":["53"],"url":["mysql://ensro@127.0.0.
## Input
my $var = decode_json($json_data);
my $url = $var->{url}->[0];
my $analysis_id = $var->{analysis_id}->[0];
my $version = $var->{version}->[0];