web service error "The script could not be parsed"

jujujuju Member Posts: 39 Guru
edited November 2018 in Help

Hi,

I have a RM process that runs well on local, but the web service has error:

de.rapidanalytics.ejb.service.ServiceDataSourceException Error executing process /home/RM/0_main_recommender for service 0_main_recommender: The script could not be parsed.

Couldn't find similar error online. Could somebody help please? Thanks!

 

RM in XML:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.4.000">
<context>
<input/>
<output/>
<macros>
<macro>
<key>TABLE_IN_KNOWN</key>
<value>-1</value>
</macro>
<macro>
<key>TABLE_IN</key>
<value>-1</value>
</macro>
<macro>
<key>PREDICTOR</key>
<value>-1</value>
</macro>
<macro>
<key>LABEL</key>
<value>-1</value>
</macro>
<macro>
<key>METRIC</key>
<value>-1</value>
</macro>
<macro>
<key>GROUP</key>
<value>-1</value>
</macro>
<macro>
<key>METADATA</key>
<value>-1</value>
</macro>
<macro>
<key>TABLE_OUT</key>
<value>-1</value>
</macro>
</macros>
</context>
<operator activated="true" class="process" compatibility="6.4.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="r_scripting:execute_r" compatibility="6.4.000" expanded="true" height="60" name="Execute R" width="90" x="45" y="30">
<parameter key="script" value="library(RODBC)&#10;library(readr)&#10;library(dplyr)&#10;&#10;&#10;# get metadata from different sources ####&#10;parse_metadata = function(table_in_known, table_in, col_predictor, col_label, col_metric, col_group, metadata, table_out){&#10; &#10; if(table_in_known != -1) { # read metadata from database&#10; &#10; &#10; ch = odbcConnect('AnalyticsEngine')&#10; &#10; sql0 = paste0(&quot;&#10; SELECT * &#10; FROM [dbo].[aap_data_attribute_metadata]&#10; WHERE [table] = '&quot;, table_in_known, &quot;'&quot;)&#10; &#10; sql0 = paste0('&#10; SELECT * &#10; FROM [dbo].[aap_data_attribute_metadata]')&#10; cat(sql0, '\n\n')&#10; &#10; metadata_fixed = sqlQuery(ch, sql0)&#10; &#10; table_in = table_in_known&#10; &#10; } else {&#10; &#10; if (metadata != -1){ &#10; &#10; &#10; &#10; &#10; } else{ # what format of metadata? XML?&#10; &#10; metadata_fixed = data.frame(metadata)&#10; &#10; }&#10; &#10; # save it to database&#10; &#10; &#10; }&#10; &#10; &#10; if(table_out == -1){&#10; table_out = paste(table_in, format(Sys.time(), '%Y_%m_%d_%H_%M_%S'), sep = '_')&#10; }&#10; &#10; &#10; list(table_in, metadata_fixed, table_out)&#10;}&#10;&#10;&#10;&#10;&#10;decide_scenario = function(metadata){&#10; &#10; if ( ! 'label' %in% metadata$role){ # unsupervised&#10; &#10; scenario = c('outlier', 'clustering') &#10; &#10; } else if ( sum(metadata$role == 'label') &gt; 1 ){&#10; &#10; stop('more than one label not allowed')&#10; &#10; } else { # supervised&#10; &#10; if (metadata[metadata$role == 'label', 'datatype'] %in% c('numeric', 'int')) {&#10; &#10; scenario = 'regression'&#10; &#10; # if(metadata[metadata$role == 'label', 'datatype'] == 'int' &amp; dat$){&#10; # &#10; # warning('are you sure the label is numeric, rather than classes?')&#10; # }&#10; &#10; } else if (metadata[metadata$role == 'label', 'datatype'] %in% c('character', 'factor')) {&#10; &#10; scenario = 'classification'&#10; } &#10; &#10; }&#10; &#10; if('datetime' %in% metadata$role){&#10; scenario = append(scenario, c('ts', 'aggregation'))&#10; }&#10; &#10; scenario = append(scenario, 'feature_engineering') # this always work?&#10; &#10;}&#10;&#10;rm_main = function(dat, in_rapidminer = T){&#10; &#10; # macro inputs from UI (default of macros is -1) ####&#10; # either data source with known metadata&#10; table_in_known = '%{TABLE_IN_KNOWN}'&#10; &#10; # or new data with metadata&#10; table_in = '%{TABLE_IN}'&#10; col_predictor = '%{PREDICTOR}'&#10; col_label = '%{LABEL}'&#10; col_metric = '%{METRIC}'&#10; col_group = '%{GROUP}'&#10; # or&#10; metadata = '%{METADATA}' &#10; # metadata (role and datatype) about the columns. If have this, `column_in` and `group` are ignored&#10; &#10; # # don't do this step now (high automation) ####&#10; # # show user available algorithms based on metadata, and use chooses some of them &#10;&#10; &#10; if(in_rapidminer == F){&#10; table_in_known = 'HHS_CLM_ROLLING_36_MONTHS_Jul14_provider_daily'&#10; }&#10; &#10; # now specify output table&#10; table_out = '%{TABLE_OUT}'&#10; &#10;&#10; # parse and organize metadata from different sources ####&#10; parsed = parse_metadata(table_in_known, table_in, col_predictor, col_label, col_metric, col_group, metadata, table_out)&#10; &#10; table_in = parsed[[1]]&#10; metadata = parsed[[2]]&#10; table_out = parsed[[3]]&#10; &#10; &#10; scenario = decide_scenario(metadata)&#10; &#10; cat('scenario:', scenario, '\n')&#10; cat('table_in:', table_in, '\n')&#10; cat('table_out:', table_out, '\n')&#10; &#10;}"/>
</operator>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
</process>
</operator>
</process>

 

Answers

  • dr-connie-brettdr-connie-brett RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 4 Contributor I

    I have seen this before when my server didn't have access to a datasource that was needed or called within the script and the script was throwing an error.  Not at my server right now, will try to look more into it tomorrow but wanted to point you in a hopefully useful direction!

  • dr-connie-brettdr-connie-brett RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 4 Contributor I

    Looked more closely - what is likely happening is a datasource connection issue from the server.  Can't reproduce obviously b/c it is your sources, but double-check connections from your RM server to the database tables.

Sign In or Register to comment.