Author Topic: Generating HTML reports from a service  (Read 1467 times)

ADD

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Generating HTML reports from a service
« on: March 01, 2012, 09:39:16 am »
I am attempting to automatically create and publish HTML reports from a domain model whenever it is checked in to source control. I am having a very strange issue that I cannot seem to resolve.

I wrote a simple application that calls Repository.OpenFile to load the .eap file, then calls Project.RunHTMLReport to create the report. When I run the application manually, it behaves as expected and the report is successfully produced.

When I have the service for the build agent run the application with the same parameters, the call to Repository.OpenFile seems to hang indefinitely without terminating or consuming any CPU (I got sick of waiting after an hour and a half of no activity). I am running the service with the same credentials that I am using to run manually, and I am a member of the Administrators group on the box in question (which is running Server 2008 R2).

Is there a known issue with using EA's automation facilities from a user that is not running in interactive mode? Is there any way I can get visibility into what's happening with EA so that I can diagnose and correct the issue? Has anyone else encountered this sort of problem?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10524
  • Karma: +358/-31
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generating HTML reports from a service
« Reply #1 on: March 01, 2012, 06:24:23 pm »
I've seen a number of forum topics about the same issue, but I don't recall seeing a solution.

Geert

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Arenīt we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: Generating HTML reports from a service
« Reply #2 on: March 01, 2012, 07:05:59 pm »
Quote
When I have the service for the build agent run the application with the same parameters, the call to Repository.OpenFile seems to hang indefinitely without terminating or consuming any CPU (I got sick of waiting after an hour and a half of no activity). I am running the service with the same credentials that I am using to run manually, and I am a member of the Administrators group on the box in question (which is running Server 2008 R2).

Some while ago I wrote a JAVA daemon running as a service which did exactly the same (running reports, creating baselines). From what I recall there have been a few issues which I do not remember but I could resolve them by using OpenFile2 instead of OpenFile.

Not sure if this solves your issue.

Instead of using Windows Services you could try to run your program as a standard executable running in a thread which wakes up every night. This is what we also did btw.

Regards,

Oliver

ADD

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Generating HTML reports from a service
« Reply #3 on: March 02, 2012, 05:23:18 am »
Thanks for your attention.

Just to rule out some weirdness involving a service launching the executable, I've attempted to run the build agent in a scheduled task running under the permissions of the appropriate account and I encounter the same issue. I've noticed that the EA.exe process continues running (while consuming no cycles) even after the calling process has terminated.

I also modified my application to use OpenFile2 (with empty strings for the login and password parameters) instead of OpenFile, and the behavior seems identical to what it was with the OpenFile call.

The only time it seems to work is if it's being called by a user running in interactive mode. Obviously, this isn't going to work for our use case. How did you manage to get it working?

ADD

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Generating HTML reports from a service
« Reply #4 on: March 06, 2012, 01:49:54 am »
Just in case anyone else runs into the same problem, I wanted to follow up with what I did to solve it. It is not an ideal solution (in fact it is kind of gross), but it works for us. Our use case was to have the documentation be automatically generated and published as part of our continuous integration build (using TeamCity).

The problem appears to be that EA (or at least some methods in the Interop.EA dll) will not function unless being called by a user with an interactive session.

What I did to solve it was to disable the TeamCity build agent service, create a script that started the agent whenever the build agent user logs in, and have the build agent user automatically log in when the system starts. It's silly and stupid, but it works.

Between diagnosing the problem and devising a solution that worked with our local group policies, I wound up wasting a lot of time. I'm not sure if this is a bug, but it would have been really nice if there was documentation somewhere that says that the Repository.OpenFile method doesn't work at all unless it is called from a process running in an interactive session. Hopefully anyone else having the same issue finds this post and winds up not having to spend the time I did.