Disable or show only first x rows of computation on smart sample data?

2 followers
1
Avatar

 

I have written a custom function that takes input values and connects to a web service to pull back data.

When building my workbooks, I don't want the function to make calls to the web-service for the smart sample data every time I modify the sheet. Is there anyway, I can either:

1) restrict computation to a few rows for specific custom functions on the smart sample data?
2) disable computation on smart sample data as a whole?

Cheers!
Nikhil

Nikhil Srinidhi

4 comments

  • Avatar
    Joel Stewart

    Hi Nkihil, the design of the sample data is definitely to get updated and executed as users make updates to the workbook. This is not something that can be disabled within a workbook. 

    However, I can think of a couple alternatives that may help in your situation. 

    First, I would consider building the workbook with a restricted sample size. The default sample size is 5,000 records, perhaps this could be lowered extremely to 10 records to limit the web-service calls.

    Alternatively, you could consider adding a second version of each function that does not use the web-service. You could use these to build the workbook in Datameer. Once the workbook was completed, you could use the REST API to replace all the development functions with the production (web-service enabled) functions. 

    1
  • Avatar
    Gido

    Hi Nikhil,

    To address your requirement

    >When building my workbooks, I don't want the function to make calls to the web-service for the smart sample data every time I modify the sheet.

    I like to propose the following approach:

    Create a Custom Function which behaves different during Workbook edit and Workbook execution

    If a Custom Function should avoid making calls to a web-service every time the Worksheet gets modified, the Custom Function would need to know when/where it is executed. How can this be achieved?

    Pre-requirement

    • Datameer Enterprise
    • Distributed Environment, Cluster 

    Solution Proposal 

    1. Introduce an environment variable, e.g. CUSTOM_FUNCTION=true
    2. Set the environment variable in <datameer-install-path/etc/das-env.sh>
    3. Restart the Datameer service
    4. Extend your Custom Plug-in to Querying Environment Variables 
    5. Check the occurrence of the introduced DAS environment variable in your Custom Plug-in
    6. It now can find out if it was called during Workbook edit or during Workbook execution
    7. Implement a switch to prevent web-service calls made during edit time

     

    Just let me know your thoughts about.

    1
  • Avatar
    Nikhil Srinidhi

    At the moment I've gone with suggestion 1: adding a dev version of the function and using REST to change it at run-time.

    I will look into Suggest 2 with regards to querying the environment variables. 

    Basic question on that (just so my understanding is right)

    At preview time, the ENV variable will be that off the Datameer server wheras at run-time it would be on the cluster nodes - correct? 

     

    0
  • Avatar
    Gido

    Right, at preview time there will be an ENV variable since the plugin is executed on the Datameer server. Whereby at run-time it is usually running on a cluster node and where the specific ENV variable will not be available.

    0
Please sign in to leave a comment.