Skip to main content
When delivering workspaces to a customer or a user, I really want the workspace to run without feature caching turned on.

With FME 2019.1 the feature caching is turned on by default. Does anyone know of a way to set this behaviour in the workspace file like a worksapce parameter?

 

Issues come when the user want to run the process again, FME 2019.1 is clever and hides the input parameters, however, not all of them. When clicking run again sometimes there is the option to select new data, however, the other options are not there. This results in unexpected behaviour (like dropping a database table instead of inserting into it...oops!)

 

The user actually needs to Re-Run the whole workspace which is also now not the default. I've been getting a lot of support request because of the workspace producing unexpected results.

 

I've also documented it and made it as clear to the customers as I can, however, the issue still comes up with users who are not familiar to FME.

 

 

I'd really like that the caching behaviour was switched off when running this.

Any ideas would be much appreciated. Perhaps @daveatsafe there is a trick like a worksapce header?

 

 

Also I'd be interested in the experience other have has on this.

I see a lot of colleagues running workspace with featurecaching on, not knowing what it does or how to turn it on or off and complaining about performance or cache issues. I would disable it by default in the installation.


Also consider voting for this Idea: https://knowledge.safe.com/content/idea/84763/run-with-feature-caching-as-workspace-parameter.html


Hmm, seems unrelated. But I voted anyway :D


Hmm, seems unrelated. But I voted anyway :D

Sorry - wrong link 🙂 https://knowledge.safe.com/content/idea/84763/run-with-feature-caching-as-workspace-parameter.html


If it is not important for the user or customer to see or edit the contents of the workspace I guess you could ask them to run it in FME Quick Translator? This will allow them to run the Workspace and amend any User Parameters at runtime, but it won't run with Feature Caching switched on.

 

si


If it is not important for the user or customer to see or edit the contents of the workspace I guess you could ask them to run it in FME Quick Translator? This will allow them to run the Workspace and amend any User Parameters at runtime, but it won't run with Feature Caching switched on.

 

si

I like this suggestion. Thanks, hopefully in a lot of cases this will do the trick. I'll have to do some more testing with it.

 

It still doesn't solve the issue fully because typically people always just double click on the .fmw file. But it is another thing to add to my documentation.

Just if anyone is interested here is a bit of python which tests if cache mode is on. Interested in feedback, I'm pretty fresh with Python and have no clue on best practice really. 

 

#Makes a call to the windows registry to get the current setting on the "Full inspection mode" entry. works with 2.7 and 3.4+
#Intened use is when you need to have a user run the workspace on FME desktop (windows only) with feature caching diabled.
#In addition the script then checks to see the parent process as the caching is only important if called from workbench.
import fme
import fmeobjects

try:
    from winreg import *
    mod=1
except:
    try:
        from _winreg import *
        mod=1
    except:
        mod=0
try: 
    from subprocess import getoutput
    import os
    sub=1
except:
    sub=0
def processFeature(feature):
    if mod ==1:
        try:
            aReg = ConnectRegistry(None,HKEY_CURRENT_USER)
            aKey = OpenKey(aReg, r"Software\\Safe Software Inc.\\FME Workbench")
            val='unknown'
            #loop through all workbench settings in registry. Loop used because depending on FME version  the Full inspection mode index could be different
            for i in range(1024):
                try:
                    asubkey_name=EnumKey(aKey,i)
                    asubkey=OpenKey(aKey,asubkey_name)
                    if asubkey_name == 'Settings':
                        val=QueryValueEx(asubkey, "Full inspection mode")
                except:
                    break
            if 'true' in val:
                inspection = 'On'
            elif 'false' in val:
                inspection = 'Off'
            else:
                inspection = 'Unknown'
            feature.setAttribute('cacheMode', inspection)
        except: 
            feature.setAttribute('cacheMode', 'unknown')
    else:
        feature.setAttribute('cacheMode', 'unknown')
        
    if sub==1:
        try:
            #check for parent process - if being run on FME Server or via Quick Translator then cache mode it not important
            pid = os.getppid()
            #print(pid)
            process_info = getoutput('wmic process where "ProcessID={}" get Caption'.format(pid))
            process_info = str(process_info)
            if 'fmeworkbench' in process_info:
                pname = 'workbench'
                feature.setAttribute('parentProcess', pname)
            else: 
                pname = 'not_workbench'
                feature.setAttribute('parentProcess', pname)
                #print(pname)
        except:
            feature.setAttribute('parentProcess', 'unknown')
    else:
        feature.setAttribute('parentProcess', 'unknown')

 


Reply