Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Testing Entrypoint extension in PTE

I've been building an Entrypoint extension that will generate a report and send it to an internal team once a week on Sunday evening. I was wondering if anybody has suggestions for testing this in PTE.

Currently, I've created a Q2 Console extension and added a button to generate the report. This has caveats, as now I'm copying the code from the Entrypoint extension into the Console extension, and I'm also constrained by HTTP timeouts since the file gets generated during the lifecycle of the request and not during a job in the background.

If what I'm doing now is the best way to achieve this, that's okay, it was worth asking.

Thanks!

Posted one year ago
Votes Newest

Answers 3


Hello,

I typically don't recommend generating reports on button push. We have a proper concept of jobs via https://docs.q2developer.com/docs/tutorials/periodic/index.html

There is a possibility of using the on_finish but you don't have visibility into it's progress very easily without building something very custom:
https://docs.q2developer.com/docs/api_references/q2_sdk/http_handlers/base.html#q2_sdk.core.http_handlers.base_handler.Q2BaseRequestHandler.on_finish

This will also struggle to pass code review as a on_finish extension because generating a report can be incredibly expensive in terms of performance. Doing it on a button push means that someone from the bank can unknowingly push the button multiple times which could lead to degraded online banking performance. To understand more specifics I recommend creating a support ticket so we can determine the best case for this particular report.

-Trey

Posted one year ago
Trey Teter
489 × 4 Administrator

Thanks for your response, Trey.

The extension itself is a Periodic Entrypoint extension, so when this is deployed, it will generate in the background w/o any user interaction to initiate the job. We don't have any intention to offer this as something that can be generated from user interaction, either. The method I described above is the only way I could think of to test this in PTE and not need to wait for an automated job to kick off to see if my changes worked or not. I was hoping somebody else would have encountered this before and been able to provide a better way of doing this.

Posted one year ago

One option to avoid the issue of on-demand generation inadvertently overloading the DB could be to continue using the periodic extension - but install it to run in PTE on a much more frequent basis there (perhaps once/hour) - and it could first check a "only_run_within_1_hour_of" timestamp set in DbConfig before proceeding with the report generation. If set - and at each periodic run it is within 1 hour of the current time - proceed and generate the report. If not set at all (or it's not within 1 hour of the current time) then exit without running the report.

In production - don't set that config - and request the periodic job to run only at the interval on which you want the report to be generated. In PTE, have it installed to run more frequently but only generate the actual report through DbConfig. This way you can update code, set a DbConfig with the current time, and have a new result within 1 hour. Not on-demand, but closer to it.

Posted one year ago
141 Views
3 Answers
one year ago
one year ago
Tags