3 Replies Latest reply on Feb 14, 2014 1:23 PM by Aantje

    Start pirecalc from ACE server

    Aantje

      Hi everybody,

       

       

       

      I have a little problem, which I'm not sure if I can solve it with PI-ACE.

       

      First, we have dedicaded ACE servers (so PI-ACE is not running on the PI-Server). 

       

      I want to do the following: I want to write an ACE module which checks if a calculation has run fine (this are PE tags on the PI server). If not, then I have to use pirecalc (on the PI Server)

       

      So is possible to start the pirecalc bat file (on the PI Server ofcourse) from the ACE module? For example: I want to run pirecalc /exe="PITag, starttime, endtime", where PITag, starttime and endtime are being declared in the ACE Module?

       

       

       

      If this doesn't work out, I can also rebuild the entire calculation in ACE. And I know there is an "undocumented" recalculation method in PI ACE (but we don't want to use that ofcourse  ) 

        • Re: Start pirecalc from ACE server
          mhamel

          @Arie: Yes, you could launch a remote pirecalc task from the PI ACE server. You have several options:

          • Use System.Diagnostics.Process class to launch a remote task on the PI Server. This can be done in your code directly. It would run with security context of the PIACEScheduler process unless you impersonate the context with another account. You would need to store the credentials somewhere. This approach is less firewall friendly as more ports would be required to allow such call.
          • Use Powershell and PS remoting to launch a remote task on the PI Server. This approach is  firewall friendly as only one port (5985 or 5986 if using SSL) is required to allow such call.
          • Another option would be to apply the same logic as described previously but outside a PI ACE module.

          I hope it helps!

            • Re: Start pirecalc from ACE server
              Aantje

              Hi Mathieu!

               

              I've been trying around with psexec (from the MS SysInternal). But I think think I'm doing something wrong :(

               

              I've created a batchfile on the PI Server (in PI\bin) which I try to start from my own machine first (as commandline command).

               

              so I give (on my own machine the following command:

               

              psexec \\PIServername\ \\PIServername\d$\PI\bin\test.bat

               

              But that doesn't work. The batchfile is found, but it seems that the batchfile is trying to start the pirecalc /exe command on my own machine.

               

              What am I doing wrong? Maybe you have some example coding for me?

               

              Greetz, Arie

                • Re: Start pirecalc from ACE server
                  Aantje

                  I've got it!

                   

                  The commandline command should be:

                   

                  C:\WINDOWS\system32>psexec \\PISERVER -i -s -u DOMAIN\USERNAME -p PASSWORD d:\pi\bin\test1.bat

                   

                  And the batchfile which I start contains the following:

                   

                  D:\PI\bin\pirecalc /exe="TestTag, 14-feb-2014 12:00, 14-feb-2014 12:01"

                   

                  I've noticed that I had to enter the full pathname to the recalc.exe in the batchfile, otherwise I wouldn't recalculate.