From aa51770d8bf44790696eede4229f74521c13b884 Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 11 Nov 2015 15:16:52 +0100 Subject: [PATCH 1/6] Read error message only once. Fix java.io.IOException: Stream closed --- grails-app/controllers/ImportXnatController.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grails-app/controllers/ImportXnatController.groovy b/grails-app/controllers/ImportXnatController.groovy index c1a72c5..52c7f21 100644 --- a/grails-app/controllers/ImportXnatController.groovy +++ b/grails-app/controllers/ImportXnatController.groovy @@ -178,11 +178,13 @@ class ImportXnatController { def process = ("python " + getScriptsLocation() + "/xnattotransmartlink/downloadscript.py ${url} ${username} ${password} ${project} ${node} ${kettledir} ${datadir}").execute(null, new File(getScriptsLocation() + "/xnattotransmartlink")) process.waitFor() - if (process.err.text == "") { - flash.message = "${process.in.text}" + def inText = process.in.text + def errText = process.err.text + if (errText) { + flash.message = "${errText}
${inText}" } else { - flash.message = "${process.err.text}
${process.in.text}" - } + flash.message = inText + } redirect action: import_wizard, id: importXnatConfiguration.id } From ad1bb927f1652d51900762f8fe8d01d1af49a24f Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 11 Nov 2015 18:01:24 +0100 Subject: [PATCH 2/6] Add logging for XNAT python script execution. --- grails-app/controllers/ImportXnatController.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/grails-app/controllers/ImportXnatController.groovy b/grails-app/controllers/ImportXnatController.groovy index 52c7f21..baa8364 100644 --- a/grails-app/controllers/ImportXnatController.groovy +++ b/grails-app/controllers/ImportXnatController.groovy @@ -1,4 +1,3 @@ -import org.springframework.util.StringUtils import org.transmart.searchapp.ImportXnatConfiguration; import org.transmart.searchapp.ImportXnatVariable; import groovy.xml.MarkupBuilder @@ -8,7 +7,6 @@ import groovy.xml.MarkupBuilder */ class ImportXnatController { - def springSecurityService def grailsApplication // the delete, save and update actions only accept POST requests @@ -176,13 +174,20 @@ class ImportXnatController { def kettledir = (getScriptsLocation() + "/xnattotransmartlink/") def datadir = (getScriptsLocation() + "/xnattotransmartlink/") - def process = ("python " + getScriptsLocation() + "/xnattotransmartlink/downloadscript.py ${url} ${username} ${password} ${project} ${node} ${kettledir} ${datadir}").execute(null, new File(getScriptsLocation() + "/xnattotransmartlink")) + def cmd = "python " + + getScriptsLocation() + + "/xnattotransmartlink/downloadscript.py" + + " ${url} ${username} ${password} ${project} ${node} ${kettledir} ${datadir}" + log.debug(cmd) + def process = (cmd).execute(null, new File(getScriptsLocation() + "/xnattotransmartlink")) process.waitFor() def inText = process.in.text def errText = process.err.text if (errText) { + log.error(errText) flash.message = "${errText}
${inText}" } else { + log.info(inText) flash.message = inText } redirect action: import_wizard, id: importXnatConfiguration.id From f4ea2f5261df7bc35053155155e251f2cba94a3f Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 11 Nov 2015 21:35:29 +0100 Subject: [PATCH 3/6] Point script to the typical ts-data file locations --- scripts/xnattotransmartlink/command.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/xnattotransmartlink/command.sh b/scripts/xnattotransmartlink/command.sh index 69d1219..e245568 100755 --- a/scripts/xnattotransmartlink/command.sh +++ b/scripts/xnattotransmartlink/command.sh @@ -1,9 +1,9 @@ #!/bin/bash -export KETTLE_HOME="/home/jenkins/transmart-data/env/tranSMART-ETL/Postgres/GPL-1.0/Kettle/Kettle-ETL/" +export KETTLE_HOME="/home/transmart/transmart-data/samples/postgres/kettle-home/" sh "/home/jenkins/transmart-data/env/data-integration/kitchen.sh" \ -norep=N \ --file="/home/jenkins/transmart-data/env/tranSMART-ETL/Kettle-GPL/Kettle-ETL/create_clinical_data.kjb" \ +-file="/home/transmart/transmart-data/env/tranSMART-ETL/Postgres/GPL-1.0/Kettle/Kettle-ETL/create_clinical_data.kjb" \ -log=load_clinical_data.log \ -param:LOAD_TYPE=I \ -param:COLUMN_MAP_FILE=xnat.tmm \ From 1ed5e0d20433d7147d7a757e25a4367425d78c6f Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 11 Nov 2015 21:36:31 +0100 Subject: [PATCH 4/6] Fix python script import statement --- scripts/xnattotransmartlink/downloadscript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/xnattotransmartlink/downloadscript.py b/scripts/xnattotransmartlink/downloadscript.py index a628775..89d4f4f 100644 --- a/scripts/xnattotransmartlink/downloadscript.py +++ b/scripts/xnattotransmartlink/downloadscript.py @@ -3,7 +3,7 @@ import pyxnat import subprocess import sys -from elementtree.ElementTree import parse +from xml.etree.ElementTree import parse CONFIG_PATH = './' CONFIG_EXTENSION = ".xml" From ab7417c2864244fc360e6e37783feb72d8afadfe Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 25 Nov 2015 16:07:10 +0100 Subject: [PATCH 5/6] Env. variable to specify the path to ts-data --- scripts/xnattotransmartlink/command.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/xnattotransmartlink/command.sh b/scripts/xnattotransmartlink/command.sh index e245568..884c5df 100755 --- a/scripts/xnattotransmartlink/command.sh +++ b/scripts/xnattotransmartlink/command.sh @@ -1,9 +1,10 @@ #!/bin/bash -export KETTLE_HOME="/home/transmart/transmart-data/samples/postgres/kettle-home/" +export TS_DATA="/home/transmart/transmart-data/" +export KETTLE_HOME="${TS_DATA}samples/postgres/kettle-home/" -sh "/home/jenkins/transmart-data/env/data-integration/kitchen.sh" \ +sh "${TS_DATA}env/data-integration/kitchen.sh" \ -norep=N \ --file="/home/transmart/transmart-data/env/tranSMART-ETL/Postgres/GPL-1.0/Kettle/Kettle-ETL/create_clinical_data.kjb" \ +-file="${TS_DATA}env/tranSMART-ETL/Postgres/GPL-1.0/Kettle/Kettle-ETL/create_clinical_data.kjb" \ -log=load_clinical_data.log \ -param:LOAD_TYPE=I \ -param:COLUMN_MAP_FILE=xnat.tmm \ From abf415e0bc95779becbb9fdffdb23d20812ee038 Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Wed, 25 Nov 2015 16:14:37 +0100 Subject: [PATCH 6/6] xnat: Give rights to more db users --- grails-app/ddl/postgres/import_xnat_configuration.sql | 3 ++- grails-app/ddl/postgres/import_xnat_variable.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/grails-app/ddl/postgres/import_xnat_configuration.sql b/grails-app/ddl/postgres/import_xnat_configuration.sql index ddd0513..6d2885e 100644 --- a/grails-app/ddl/postgres/import_xnat_configuration.sql +++ b/grails-app/ddl/postgres/import_xnat_configuration.sql @@ -13,7 +13,8 @@ CREATE TABLE searchapp.import_xnat_configuration ( ); ALTER TABLE searchapp.import_xnat_configuration OWNER TO searchapp; GRANT ALL ON TABLE searchapp.import_xnat_configuration TO searchapp; - +GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE searchapp.import_xnat_configuration TO biomart_user; +GRANT ALL ON TABLE searchapp.import_xnat_configuration TO tm_cz; -- -- Name: pk_import_xnat_configuration; Type: CONSTRAINT; Schema: searchapp; Owner: - -- diff --git a/grails-app/ddl/postgres/import_xnat_variable.sql b/grails-app/ddl/postgres/import_xnat_variable.sql index 6509a8d..d826d3e 100644 --- a/grails-app/ddl/postgres/import_xnat_variable.sql +++ b/grails-app/ddl/postgres/import_xnat_variable.sql @@ -10,7 +10,8 @@ CREATE TABLE searchapp.import_xnat_variable ( ); ALTER TABLE searchapp.import_xnat_variable OWNER TO searchapp; GRANT ALL ON TABLE searchapp.import_xnat_variable TO searchapp; - +GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE searchapp.import_xnat_variable TO biomart_user; +GRANT ALL ON TABLE searchapp.import_xnat_variable TO tm_cz; -- -- Name: pk_import_xnat_var; Type: CONSTRAINT; Schema: searchapp; Owner: - --