optimatorlab / veroviz

Vehicle Routing Visualization package
https://veroviz.org
MIT License
39 stars 9 forks source link

Error Code 429: Too Many Requests #16

Open SyedShahSultan opened 4 years ago

SyedShahSultan commented 4 years ago

Please use the template below to submit your bug report.

Describe the bug In my case study, there is a depot that has 4 vehicles on 4 different routes. The total no. of customers needs to be visited are around 22 and a depot. When I am assigning fewer customers to 1st 3 vehicles (around 1 or two), the 4th vehicle who has to cover all the remaining customers is giving me an error like Error Code 429: Too Many Requests (sometimes. not always). Secondly when I am combining the codes of all the 4 vehicles is a single "Spyder-Python" file, it fails to execute anything. Furthermore, I am unable to change the pin color of my depot through a loop, to distinguish it from the customers.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....' 4. See error

Expected behavior I want to show all the routes of my vehicles on a single map with the different pin of my depot through "Spyder Environment". I am planning to run the code with Python's GUI platform.

Screenshots image

image

Python Version (please complete the following information):

VeRoViz Version:

# Paste the result of the following Python command:
import veroviz as vrv
vrv.checkVersion()

'Your current installed version of veroviz is 0.3.1. You are up-to-date with the latest available version.'

Operating System (please complete the following information):

VeRoViz Code.zip

Windows 10]

Additional context Add any other context about the problem here.

cmurray3 commented 4 years ago

Hi, Syed, Sorry you're experiencing issues, and thanks for submitting an issue ticket so we can try to improve VeRoViz.

Could you please attach your .xlsx files so we can run your Python code and work on fixes?

When I am assigning fewer customers to 1st 3 vehicles (around 1 or two), the 4th vehicle who has to cover all the remaining customers is giving me an error like Error Code 429: Too Many Requests (sometimes. not always).

Based on my initial look at your code/issue, the "429" error is coming from OpenRouteService. They have a limit on the number of requests that can be made per minute. We will be updating veroviz to automatically insert a waiting time to prevent this issue. In the meantime, you can manually insert a "sleep" time to adhere to the rate limits. Rate limit info is available here: https://openrouteservice.org/plans/

Secondly when I am combining the codes of all the 4 vehicles is a single "Spyder-Python" file, it fails to execute anything.

This often happens in single Python scripts...if there's an error anywhere the entire script will fail. You can use try and except to capture these issues. Hopefully the fixes we implement in the next veroviz version will address the particular issues you're experiencing.

Furthermore, I am unable to change the pin color of my depot through a loop, to distinguish it from the customers.

I'll have to look more closely at your code to see what's happening. It looks like you're trying to implement a custom marker, which we currently don't support in veroviz. If you're looking for different pin colors, though, you can do that with the currently-supported pins in veroviz. See https://veroviz.org/docs/leaflet_style.html#leaflet-prefix-and-leaflet-type for more info.

SyedShahSultan commented 4 years ago

Thanks a lot, Sir for your prompt reply and for your suggestions. I will definitely go over those suggestions. .xlsx files used in the code is attached for your consideration.

Data_Coordinates.xlsx Vehicle1_Patients.xlsx Vehicle2_Patients.xlsx Vehicle3_Patients.xlsx Vehicle4_Patients.xlsx

cmurray3 commented 4 years ago

I believe I have identified the cause of the 429 error:

For the depot node coloring, I've made some changes to your Jupyter notebook (attached), which should make it easier for you to accomplish this.

Archive.zip


As an issue, I don't see an immediate/obvious "fix" from VeRoViz's side. However, we should update our documentation to indicate the following:

  1. It is the user's responsibility to monitor the rate of requests being made to external data providers.
  2. Some of these rate limits can be avoided by using "locally" installed versions of the data providers.
    • We'll be integrating these options in version 0.4.0 of VeRoViz.
SyedShahSultan commented 4 years ago

Thanks for taking out some time from your busy schedule. There is one more suggestion. I don't know whether it's on your list or not. Or maybe I am missing that part. There should be some way by which a driver able to check it's position. This will help the driver to follow the given routes. And I don't feel any hesitation in saying that you guys are really doing a great job. Thanks a lot once again.

SyedShahSultan commented 4 years ago

I do not understand how to use "os.environ". Previously I was initializing my ORS key without this function. Because whenever I was using that function, I was having some error. The same thing is happening now again. Below is what you suggest.

image

Here this is what I am getting. I am unable to understand my mistake.

image

I am getting no error if I am initializing my ORS key directly without "os.environ".