When does INSTALLED_APPS get imported on GAE if there is no warmup request? - django-nonrel

djangoappengine.views.warmup does its job of loading all Django apps when GAE sends a warmup request. If GAE does not send a warmup request, either due to request spike or because warmup service is not enabled, then when does INSTALLED_APPS get imported? I see that djangoappengine.deferred.handler.application loads all INSTALLED_APPS, but djangoappengine.main.application does not.
The problem I'm having is that if there is no warmup request, then either that first loading request handler or subsequent request handler may need a nonrel-search model field which is not yet registered, because search was not imported via INSTALLED_APPS and thus autodiscover() did not yet run.
My settings MIDDLEWARE_CLASSES does have 'autoload.middleware.AutoloadMiddleware', so I would think that it could load that way without warmup, but it's not.
What is the solution to make sure everything is loaded before handling any requests?

The solution is to call search.autodiscover() in the site's urls.py, in addition to having autoload and search in INSTALLED_APPS, as well as autoload.middleware.AutoloadMiddleware in MIDDLEWARE_CLASSES.
The reason is that while djangoappengine.views.warmup and djangoappengine.deferred.handler.application load INSTALLED_APPS and result in search.autodiscover() being called, djangoappengine.main.application does not does not do that. So if your GAE instance is fired up directly by a request, then the search indexes will not be registered. Therefore, search.autodiscover() in urls.py is necessary to register those indexes.

Related

Mule API timing out for one path but works for fine for other path

I have a Mule API which calls another system. The call to the another system are included in a common flow and parameters are set dynamically.
The high level API paths are:
GET /invoices
POST /workorder
Despite having a common configuration, the calls made to /workorder path are successful, but calls to "invoices" get request timed out error. I tried both requests in Postman too and it is the same behaviour.
Any idea how can this issue be resolved?
Like #aled mentioned the question is too broad,
What I understand there's a mule api (lets call it a proc) which calls another system api (sys).
Cause for this is that the target is taking more time than the source is willing to wait for the response.
The first things to do would be to increase the response timeout at proc requestor configuration, the default response timeout is 10s (10000 milliseconds), increase this value till it no more gives this error at proc.
If the error is returned from sys api when calling from postman, do the same for sys api for its request configuration.
Reference - Request Configuration
Hope this helps.

FLOWABLE: Authenticating flowable-task from another application via rest call

So, I am creating an application which will be using flowable.
We can say that once my application starts, it's gonna start a particular process deployed on flowable, proceed ahead accordingly.
So, in a way there will be lot of talking between flowable and other application, but for now suppose I just want to call flowable applications from POSTMAN (outside FLOWABLE).
I have used 3 modules: flowable-idm, flowable-modeler, flowable-task in my application.
Everything works fine when I am starting my deployed process from UI of flowable task, problems come when I want to start the processInstance using REST endpoint.
In flowable-task application, there is already a REST endpoint to start the process deployed: http://localhost:8080/flowable-task/app/rest/process-instances.
Now, if I call this from Swagger of flowable-task application, it works fine.
But it doesn't work when I try to call it from another application or POSTMAN for now (once POSTMAN call works, I can make the same arrangement in code), where I'm doing a basic auth and providing what's required in body.
Also, there is no error or exception displayed on console, I believe that is because of something catching that error or exception and not displaying anything.
However, to overcome the problem of starting process from POSTMAN, I can use REST endpoint http://localhost:9999/flowable-task/process-api/runtime/process-instances, but this is just a workaround, in future if I create new endpoints I would have to figure out a way to call those endpoints.
I saw this post and I guess this guy was also trying to achieve something similar but for flowable-modeler.
It's been suggested to make changes in SecurityConfiguration.java of flowable-task-conf module for my case, but I haven't done such changes before so not exactly sure where to start and how to proceed.
So, my question is how to talk to flowable-applications from outside flowable applications.
Edit:
Forum post about getting exception when imported flowable-rest module in workspace
The flowable-task UI Application is an example application that exposes non public REST API for the UI. However, the application also exposes the full REST API of Flowable.
There is also the flowable-rest application that has the Swagger doc and exposes the full REST API without a UI.
You would want to communicate with those REST endpoints.
The endpoints are under the following contexts:
process-api for the Process Engine
cmmn-api for the CMMN Engine
dmn-api for the DMN Engine
idm-api for the IDM Engine
form-api for the Form Engine
content-api for the Content Engine
For your example you would need to use POST to /process-api/runtime/process-instances for Starting a Process Instance

Detect Authorized response after AJAX call

I have an API which I consume from a VueJS app, backend is handled through Laravel 5.2.
I have setup automatic session timeout after 15min, but if happens you're in the site and try to do anything, I have a loading screen, and it freezes as you're unauthorized.
I wanted to know if there's any global method to read Unauthorized response when all requests are made.
I don't know what this is called, so I wouldn't know how to properly Google the feature.
I'm using VueJS Resource $http library to manage all requests.
Thanks!
I've finally made my way to the right documentation, it was under Vue-Resource, and these are called Interceptors.
https://github.com/vuejs/vue-resource/blob/master/docs/http.md

Retrieve response object after UI action?

so I've created several service tests where I validate the response object, normally using the requests library or http library to send a POST request for example.
This time however I'm doing an end-to-end test. Through the UI progressing through a workflow, one stage involves uploading a document, behind the scenes this will call a separate service, the response of which will contain some information that could be useful to me for further verification.
Is there a way to merge these? After the UI action can I 'listen' for the response object somehow?
I do NOT wish to call the endpoint directly as I want to prove the workflow is as intended, the endpoint is verified directly in service level tests already.
Integrate Selenium tests with BrowserMob Proxy and you will be able to 'listen' for the responses using HAR file:
https://bmp.lightbody.net/
Java repo where the feature is implemented: https://github.com/Wikia/selenium-tests

JMeter's ResourceLastAccessedTime GET request failed

I am trying to use JMeter to test our Web Application. We originally used LoadComplete to test our Web Application, but because LoadComplete is not able to run on a non-GUI mode, we were not able to use the max stat’s from our test server (strain our 8 CPU’s and 8GB’s of RAM). That is why I moving towards JMeter (https://blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui).
The test includes logging in, choosing a specific app, do a simple task through this app and then end the recording. The HTTP Requests, which are failing are printing Failed Access on their Response Data on the View Results Tree.
I used the HTTP(S) Test Script Recorder to record each HTTP request. My JMeter project is failing on a few different HTTP Requests, which includes oauthtoken Get Request that includes jessionid="item", a GET resourceLastAccessedTime Request, and a couple GET resourceLastAccessedTime Requests. I tried to follow blazementer's guidance for how to use JMeter for Login Authentication, because these requests seem to be involved with the authentication of each user after logging in and the problem I am getting on Response data for each of these requests on the View Results Tree it says Access denied. (https://docs.blazemeter.com/customer/portal/articles/1743663-how-to-use-jmeter-for-login-authentication-).
One of the steps is to "copy and paste" the Parameters from the Post request after you login to these requests. I can add these parameters to these requests right below where it says Send Parameters with the request, but our POST request only has two parameters (the login name and the password). Is there somewhere else to look for these parameters?
I tried a combination of a lot of different attempts, but I am still unsuccessful (meaning: I moved the Regular Expression Extractor to a few different HTTP requests and I moved which HTTP requests to put those parameters and I have not been successful yet).
Do you know of a URL that could be helpful for this?
Don't trust Test Script Recorder! It doesn't follow any logic while recording your requests. It just records requests processed through proxy as they are. In case you use parameters that can't be defined as constants, the best way would be to rewrite the script manually.
Be patient and spend some hours (only once!) to learn how to construct any test scenarios (even complex) manually using Jmeter GUI. It will save you a lot of time for debugging.
It seems like (just a guess) that your test scenario doesn't contain Cookie Manager item. Based on what you wrote above, it seems like after logging to serer (by sending POST with login and password) it sets some cookies by Set-Cookie HTTP header. These cookies should be included in every next request as a prove that you successfully logged in before (the most common logic for simple web applications). So, if you get Access Denied, means you didn't include appropriate cookies in test request. Use Cookie Manager for that.
Feel free to ping me in case you need any assistance.
Jmeter help manual is all you need to know about how each element works.
P.S.: Jmeter also can generate distributed load from multiple slave servers, in GUI and CLI modes both. So, in case you need to stress your server yout, Jmeter is the best choise.
And welcome to Jmeter users family! Good luck.