OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Cloud Run in Google Cloud doesn't recognize time.sleep() in my Python script

  • Thread starter Thread starter geometricfreedom
  • Start date Start date
G

geometricfreedom

Guest
I have a Cloud Run service running a Python script in a Docker container.

Running the script on a VM in GCP or locally works fine. It recognizes the time.sleep() in my script.

But Cloud Run does not. What I have in my script is code for collecting data every 2 minutes because the data is updated every 2 minutes. And it is encapsulated in a while loop where if the loop takes 40 seconds then I set this to time.sleep(80).

But Cloud Run is not recognizing it and below are my service settings. Cloud Run doesn't sleep but immediately starts next iteration in the loop. Where as if it was local or on the VM it would sleep for 80 seconds per iteration and then continue to the next iteration.

Code:
Minimum service autoscaling instances = 0
Minimum revision autoscaling instances = 0
Maximum revision autoscaling instances = 1
Maximum concurrent requests per instances = Tried both 6 and 80

Any idea?
<p>I have a Cloud Run service running a Python script in a Docker container.</p>
<p>Running the script on a VM in GCP or locally works fine. It recognizes the <code>time.sleep()</code> in my script.</p>
<p>But Cloud Run does not. What I have in my script is code for collecting data every 2 minutes because the data is updated every 2 minutes. And it is encapsulated in a <code>while</code> loop where if the loop takes 40 seconds then I set this to <code>time.sleep(80)</code>.</p>
<p>But Cloud Run is not recognizing it and below are my service settings. Cloud Run doesn't sleep but immediately starts next iteration in the loop. Where as if it was local or on the VM it would sleep for 80 seconds per iteration and then continue to the next iteration.</p>
<pre><code>Minimum service autoscaling instances = 0
Minimum revision autoscaling instances = 0
Maximum revision autoscaling instances = 1
Maximum concurrent requests per instances = Tried both 6 and 80
</code></pre>
<p>Any idea?</p>
 

Latest posts

A
Replies
0
Views
1
AgencyAnalytics
A
S
Replies
0
Views
1
Stacker Media
S
C
Replies
0
Views
1
CC.Talent
C
Top