Options

Open file

javemarjavemar Member Posts: 23 Contributor II
edited November 2018 in Help
Hello 


Hello 


I would like to ask for help because I have the next problem. I'm able to open a file(eg a excel workbook) with rapidminer through the "execute program" operator, using the "cmd/ c star c:/somedirectory/file.format" parameter, but when I tried to run this through rapydanalytics the program didn't open and didn't give me any error. In fact, the process never ends

Somebody know which could be the problem. I really appreciate your help.


Tagged:

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hello, hello,

    can you please tell us what you want to achieve?
    Do you really want to open the file in excel, such that the user can view the data in excel, or do you want to load the data, such that RapidMiner/RapidAnalytics can process the data from the excel file?

    Best regards,
    Marius
  • Options
    javemarjavemar Member Posts: 23 Contributor II
    Hello Marius.


    My goal is make a little report in excel. I use rapidanalytics/rapidminer to extract info from a database and then write a excel file. Then, I want to open a macro in excel (xlsm) that let me make some pivot charts and pivot tables with this information. I can do it with rapidminer , but I cant with rapidanalytics.

    I really apreciate all your help. Thanks Marius


  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Ok, please be more specific. Which part exactly does not work in RapidAnalytics? Is it the last part, i.e. running excel? Please remember that the process is running on the RapidAnalytics server, so if you try to run a program from within your process, this would be done on the server. This probably does not make much sense, since probably nobody except the server admin could see the reports popping up on the server machine :)
  • Options
    javemarjavemar Member Posts: 23 Contributor II
    Hello Marius


    You are right, the excel file is generate within the server throught other excel macro.
    I can within rapidminer using "cmd/ c star c:/somedirectory/macro.xlsm
    Then, I send this report (excel file) through email to other pcs.

    The problem in rapidanalytics is that I can't open the xlsm in the server.  I'm a little newbie using web services and I'm running rapidanalytics in my own pc.

    Thanks a lot for your patience and help Marius
  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi,

    so let me sum up:
    - you are running RapidAnalytics on the same pc as RapidMiner
    - you are executing the same process one time in RapidMiner and one time on RapidAnalytics
    - in RapidMiner the process runs fine, but on RapidAnalytics it fails

    Is that correct?

    Please post the xml of your process as described in the post linked in my signature, so I can have a look at it.

    ~Marius
  • Options
    javemarjavemar Member Posts: 23 Contributor II
    Hello Marius.

    Yes Marius, you are right.

    Here is a example of my process.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="write_excel" compatibility="5.2.008" expanded="true" height="76" name="Write Excel (2)" width="90" x="112" y="120">
        <parameter key="excel_file" value="D:\carpeta/archivo.xls"/>
        <parameter key="file_format" value="xls"/>
        <parameter key="encoding" value="SYSTEM"/>
        <parameter key="sheet_name" value="RapidMiner Data"/>
        <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
        <parameter key="number_format" value="#.0"/>
      </operator>
    </process>
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="execute_program" compatibility="5.2.008" expanded="true" height="76" name="Execute Program" width="90" x="246" y="120">
        <parameter key="command" value="cmd /c start D:\carpeta\macro.xlsm"/>
        <parameter key="log_stdout" value="true"/>
        <parameter key="log_stderr" value="true"/>
      </operator>
    </process>
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="execute_script" compatibility="5.2.008" expanded="true" height="76" name="Interno" width="90" x="447" y="120">
        <parameter key="script" value="import java.util.Properties;&#10;import javax.activation.DataHandler;&#10;import javax.activation.DataSource;&#10;import javax.activation.FileDataSource;&#10;import javax.mail.*;&#10;import javax.mail.internet.InternetAddress;&#10;import javax.mail.internet.MimeBodyPart;&#10;import javax.mail.internet.MimeMessage;&#10;import javax.mail.internet.MimeMultipart;&#10;import java.text.SimpleDateFormat;&#10;&#10;public class MailWithAttachment&#10;{&#10;public static void main(String []args) throws Exception&#10;{&#10;    SimpleDateFormat formateador = new SimpleDateFormat(&quot;dd/MM/yyyy H&quot;);&#10;    String host = &quot;smtp.gmail.com&quot;;//host name&#10;    String from = &quot;direccion@mail.com&quot;;//sender id&#10;    String to = &quot;persona@mail.com&quot;;&#10;  &#10;    &#10;    String nombre = &quot;Resultado.xlsx&quot;;&#10;&#10;    String pass = &quot;pass&quot;;//sender's password &#10;    String fileAttachment = &quot;D:\\carpeta\\archivo.xlsx&quot;;//file name for attachment &#10;    //system properties&#10;    Properties prop = System.getProperties();&#10;    // Setup mail server properties&#10;    prop.put(&quot;mail.smtp.gmail&quot;, host);&#10;    prop.put(&quot;mail.smtp.starttls.enable&quot;, &quot;true&quot;);&#10;    prop.put(&quot;mail.smtp.host&quot;, host);&#10;    prop.put(&quot;mail.smtp.user&quot;, from);&#10;    prop.put(&quot;mail.smtp.password&quot;, pass);&#10;    prop.put(&quot;mail.smtp.port&quot;, &quot;587&quot;);&#10;    prop.put(&quot;mail.smtp.auth&quot;, &quot;true&quot;);&#10;    //session &#10;    Session session = Session.getInstance(prop, null);&#10;    // Define message&#10;    MimeMessage message = new MimeMessage(session);&#10;    message.setFrom(new InternetAddress(from));&#10;    message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));&#10;  &#10;&#10;    message.setSubject(&quot;Mensaje&quot;);&#10;    // create the message part &#10;    MimeBodyPart messageBodyPart = new MimeBodyPart();&#10;    //message body&#10;    messageBodyPart.setText(&quot;Este es el mensaje y un archivo adjunto.&quot;);&#10;    Multipart multipart = new MimeMultipart();&#10;    multipart.addBodyPart(messageBodyPart);&#10;    //attachment&#10;    messageBodyPart = new MimeBodyPart();&#10;    DataSource source = new FileDataSource(fileAttachment);&#10;    messageBodyPart.setDataHandler(new DataHandler(source));&#10;    messageBodyPart.setFileName(nombre);&#10;    multipart.addBodyPart(messageBodyPart);&#10;    message.setContent(multipart);&#10;    //send message to reciever&#10;    Transport transport = session.getTransport(&quot;smtp&quot;);&#10;    transport.connect(host, from, pass);&#10;    transport.sendMessage(message, message.getAllRecipients());&#10;    transport.close();&#10;}&#10;}"/>
        <parameter key="standard_imports" value="true"/>
      </operator>
    </process>


    macro.xlsm takes the archivo.xls, makes some operations and writes the archivo.xlsx. Then, the script send a email with archivo.xlsx


    Thanks Marius
  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi,

    you did not post valid xml. Please use the steps explained in the post linked in my signature.

    However, probably your problem arises from the fact that RapidAnalytics is started as a windows service and thus does not have the possibility to create GUI windows. You could try to stop the service and start it manually via the run.bat. But please consider that this will only work as long as RapidAnalytics is running on your local computer, and in this case I can see no big advantage over using plain RapidMiner. As soon as you deploy RapidAnalytics to a true server machine, that process won't run anymore.

    Best regards,
    ~Marius
  • Options
    javemarjavemar Member Posts: 23 Contributor II
    Hello Marius


    I didn't know that I can´t open a GUI with a windows service, this is a little sad for my goal. I suppose that I have to change the approach. I'm going to set some schedule task in windows and try to run a bat file that let me run rapidminer and the Excel GUI.


    Thank Marius for your help

Sign In or Register to comment.