Question

Accesing FME Server custom shared resources from a workspace

  • 11 December 2018
  • 4 replies
  • 14 views

Badge +10

I have created a shared resource directory (named PROJ) based on this article.

I'm using it in a (type: text) private parameter (named SHAREDRESOURCE_PROJ) as I would do with an FME parameter :

$(FME_SHAREDRESOURCE_PROJ)\Templates

And I access that parameter from a number of scripted private parameters like this:

import fme
templateA = fme.macroValues[‘SHAREDRESOURCE_PROJ’] + '/templateA.ini'
return templateA

When executing my workspace from FME Server it throws the error ' failed to evaluate Python script'.

If I replace $(FME_SHAREDRESOURCE_PROJ) with the actual path to the folder it works so the problem is the resource directory parameter, but I don't want to use the hardcoded path.

What am I doing wrong?


4 replies

Userlevel 4

Why do you mention FME_SHAREDRESOURCE_PROJ and SHAREDRESOURCE_PROJ, which one did you define?

You need to reference the value from the Name column when you defined the resource connection:

Badge +10

Why do you mention FME_SHAREDRESOURCE_PROJ  and SHAREDRESOURCE_PROJ, which one did you define? 

You need to reference the value from the Name column when you defined the resource connection:

0684Q00000ArLUIQA3.png

I defined the resource directly in the FME Server configuration file (FMEServerDir>Server\fmeServerConfig.txt) with the name FME_SHAREDRESOURCE_PROJ:

SHAREDRESOURCE_TYPE_8=FILE
SHAREDRESOURCE_NAME_8=FME_SHAREDRESOURCE_PROJ
SHAREDRESOURCE_DISPLAYNAME_8=PROJ
SHAREDRESOURCE_DESCRIPTION_8=This shared resource is the project data directory
SHAREDRESOURCE_ISMIGRATABLE_8=true
SHAREDRESOURCE_DIR_8=C:/ProgramData/Safe Software/FME Server///resources/proj/
SHAREDRESOURCE_SECURITY_DEFAULT_ROLES_8=fmeadmin
SHAREDRESOURCE_SECURITY_DEFAULT_OWNER_8=admin

 

SHAREDRESOURCE_PROJ is the name of the private parameter. It could be simply PROJ or whatever. If that's confusing let me change my example:

PROJ private parameter:

$(FME_SHAREDRESOURCE_PROJ)\Templates

Scripted private parameter:

import fme
templateA = fme.macroValues[‘PROJ’] + '/templateA.ini'
return templateA
Userlevel 4

Since you've tagged your question with FME Server 2018, I would definitely recommend that you create the resource connection in the GUI. The document you linked to is for FME Server 2016 and should not be used for FME Server 2018.

That said, you need to use the complete name in the scripted parameters etc, for example:

A = fme.macroValues['FME_SHAREDRESOURCE_PROJ']

There is more information on the subject here:

https://knowledge.safe.com/articles/34522/fme-server-resources-uploading-referencing-and-con-1.html

Badge +10

Since you've tagged your question with FME Server 2018, I would definitely recommend that you create the resource connection in the GUI. The document you linked to is for FME Server 2016 and should not be used for FME Server 2018.

That said, you need to use the complete name in the scripted parameters etc, for example:

A = fme.macroValues['FME_SHAREDRESOURCE_PROJ']

There is more information on the subject here:

https://knowledge.safe.com/articles/34522/fme-server-resources-uploading-referencing-and-con-1.html

I don't know why that document is not in the Administrator's Guide anymore. It does work and that way you don't have to provide a network directory as it uses the default location of the Resources folder.

Apart from that, it works if I use the resource connection as you say but that's not what I want to do.

 

I want to use a private parameter pointing to a folder in my resource connection, and then use that private parameter inside another (actually a number of) private parameter. That's what's giving me an error.

The reason to do it like this is because the folder name inside the resource connection may change and otherwise I'd have to change it in all parameters accessing that folder. This way it's just a change in one parameter.

Reply