Question

config-file for several workbenches

  • 26 September 2013
  • 10 replies
  • 3 views

Badge
Hi,

 

I've written 28 workbenches, which are published on FME-Server. They are connected by topics. The workbenches read data from several postgis-databases. I can decide if they are reading data from our test-environment or out of the production-environment by setting each time the published parameter.

 

But , I want to do this only once. So I thought about a config file which include the postgis-Hostname to make for all 28 workbenches only one parameter setting.

 

 

Do you have solution

 

 

Barbara

 


10 replies

Userlevel 4
Badge +13
Hi,

 

 

Why 28 ws if you could do the work in 1? just a thought....
Userlevel 4
Badge +13
Ignore that thought I realize that you probably want to trigger the workspaces on different topics ...
Badge
I need so many workbenches. All Workbenches to gether needs 14 MB. So to have only one Workbench is to big for loading and manging.

 

The other point is,  that I read data from 4 really different databases and I have to merge, the data in a new database schema. First I have  to read all datarecords. After that , I have to do the data evaluations over all data( f.ex. bounding box). So I need all data in one structure. At the end I have to fill 38 tables in the database. 

 

With the help of job-success-topics the workbences run in a right order.

 

 

I know, that I could build up a batch file to start the workbenches. The hostnames in the batch file could replaced in a text-editor. So I have to start the batch-file with windows task-schedular. But I want to start it from FME_Server-schedular. 

 

 

I hope you understand my english ;-)

 

 

 

   

 

 

 

 

 

 

 

 

Userlevel 4
Hi,

 

 

one common solution for this is to use a scripted parameter to read an external config file into a private parameter, which you can then reference in your workspace.

 

 

While this FMEPedia article isn't specifically about your case, it should give you some pointers to get started.

 

 

David
Badge
thanks a lot, that was the solution.

 

my private parameter looks like

 

Badge
hi,

 

inserting a hardcopy doesn't work

 

 

the code of the scripted parameter is:

 

FME_MacroValues['Host'] = ''

 

ifile=open("D:\\config.txt", "rb")

 

FME_MacroValues['Host'] = ifile.read(20)

 

ifile.close()

return FME_MacroValues['Host']

 

thanks once more
Userlevel 2
Badge +17
Hi Barbara,

 

 

1. In a character string literal, a \\ (back slash) should be escaped. You should write a file path like this:

 

"D:\\\\config.txt" (escape back slash)

 

or "D:/config.txt" (use slash instead of back slash)

 

 

2. A parameter value cannot be changed at run-time. You can get the value of 'Host' parameter in a scripted parameter (only when 'Host' parameter is defined before the scripted parameter), but you cannot assign a value to 'Host' parameter.

 

Your script might return a value read from the file, but value of 'Host' parameter will not be changed.

 

 

Takashi
Badge
Hi Takashi,

 

first i defined a private Parameter Host. I filled it as a scripted waameter. And then I link the hostname of the Postgis-Reader or Writer to the private parameter. So it works.

 

thanks for the advice with correct writing paths

 

 

barbara
Userlevel 2
Badge +17
Ah, 'Host' was name of the scripted parameter itself? If so, you can define the script like this, you don't need type "FME_MacroValues...".

 

----- ifile=open("D:/config.txt", "rb") host = ifile.read(20) ifile.close() return host

 

-----
Badge
oh yes. I became blind to see simple things by thinking of this problem solving.

 

Thanks

Reply