I have a very large list of schedules in pagerduty.
When I run the command:
docker run --network=host --rm -e PAGERDUTY_API_TOKEN="TOKEN_PAGERDUTY" -e ONCALL_API_URL="http://localhost:8080" -e ONCALL_API_TOKEN="TOKEN_ONCALL" -e MODE="plan" pd-oncall-migrator
I get the following error
▶ Fetching users...
▶ Fetching schedules...
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.9/http/client.py", line 1377, in getresponse
response.begin()
File "/usr/local/lib/python3.9/http/client.py", line 320, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.9/http/client.py", line 281, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.9/ssl.py", line 1242, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python3.9/ssl.py", line 1100, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 451, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 340, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.pagerduty.com', port=443): Read timed out. (read timeout=5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pdpyras.py", line 550, in request
response = self.parent.request(method, my_url, **req_kw)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 532, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.pagerduty.com', port=443): Read timed out. (read timeout=5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/app/migrator/__main__.py", line 129, in <module>
main()
File "/app/migrator/__main__.py", line 52, in main
schedules = session.list_all("schedules")
File "/usr/local/lib/python3.9/site-packages/pdpyras.py", line 1296, in list_all
return list(self.iter_all(path, **kw))
File "/usr/local/lib/python3.9/site-packages/pdpyras.py", line 1171, in iter_all
r = self.get(path, params=data.copy())
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pdpyras.py", line 555, in request
raise PDClientError("Non-transient network error; exceeded "
pdpyras.PDClientError: Non-transient network error; exceeded maximum number of attempts (3) to connect to the API.
I have a very large list of schedules in pagerduty.
When I run the command:
docker run --network=host --rm -e PAGERDUTY_API_TOKEN="TOKEN_PAGERDUTY" -e ONCALL_API_URL="http://localhost:8080" -e ONCALL_API_TOKEN="TOKEN_ONCALL" -e MODE="plan" pd-oncall-migrator
I get the following error
File: https://github.com/grafana/oncall/blob/ed4be171f67e85eb8476a4fe5a24040ac6f85b01/tools/pagerduty-migrator/migrator/__main__.py#L51