Skip to main content

I'm working with FME 2020.2.4

I know how to check from within a workspace whether it is run from FME Destkop o from FME Server. I just check in a scripted parameter if FME_SHAREDRESOURCE_[whatever] exists in fme.macroValues.

 

But, is there any way to check whether a workspace is run from a Workspace App or from an automation?

In the Jobs tab in FME Server there's a Source Type column with value Automations, Workspace Apps or empty to indicate it. I want to get that same information in the workspace to include it in an email sent from the shutdown python script.

 

Hi @dms2​ ,

 

The FME Server REST API endpoint GET /transformations/jobs/id/< jobid >

can be used to pull down the same information that is displayed on the Jobs tab:

  1. In your workspace add an HTTPCaller and set the request URL to http://HOSTNAME/fmerest/v3/transformations/jobs/id/$(FME_JOB_ID) and make sure to set up the authentication details as well. NB: we are using the FME Server Parameter Job ID to make sure we are pulling the information for the current job.
  2. Add a JSONFlattener to the Output port and set the 'JSON Document' to the _response_body attribute and the 'attributes to expose' to sourceType
  3. To verify it is set up correctly, add a logger and run the workspace on FME Server, it should hold the value AUTOMATIONS, SERVER_APPS or empty

Hi @dms2​ ,

 

The FME Server REST API endpoint GET /transformations/jobs/id/< jobid >

can be used to pull down the same information that is displayed on the Jobs tab:

  1. In your workspace add an HTTPCaller and set the request URL to http://HOSTNAME/fmerest/v3/transformations/jobs/id/$(FME_JOB_ID) and make sure to set up the authentication details as well. NB: we are using the FME Server Parameter Job ID to make sure we are pulling the information for the current job.
  2. Add a JSONFlattener to the Output port and set the 'JSON Document' to the _response_body attribute and the 'attributes to expose' to sourceType
  3. To verify it is set up correctly, add a logger and run the workspace on FME Server, it should hold the value AUTOMATIONS, SERVER_APPS or empty

It seems rather convoluted to have a job having to ask the server REST interface about some info about itself.

The workspace already have information about its job ID and a lot of other server related information in the "FME Server Parameters" list. Wouldn't it be simpler to append all server information to this list?


It seems rather convoluted to have a job having to ask the server REST interface about some info about itself.

The workspace already have information about its job ID and a lot of other server related information in the "FME Server Parameters" list. Wouldn't it be simpler to append all server information to this list?

Hi @Lars I Nielsen​ ,

There is currently no FME Server Parameter to read this information in, but it certainly would be helpful for this scenario! Please consider posting an idea to request this enhancement.


I had the same problem. Thanks for sharing the solution, folks. I’ve been trying to solve it for a month, I guess. Eventually, my friend who runs ข่าว IT shared this page with me. And, you know, I’m really happy I’ve finally managed to fix it. Tbh, I really like this forum and highly appreciate the members’ help here. Actually, I’d never thought that people could be so selfless. I think it’s the main idea of all the forums. Anyway, keep the topic updated on new solutions. Best wishes. Thanks in advance


Reply