betagouv / SPPNautSPO

Generator and S3 interface for SPPNaut Startup
European Union Public License 1.2
0 stars 0 forks source link

Use Sentry Cron to report when `full_sync` can't access the shom proxy #48

Open kolok opened 1 year ago

kolok commented 1 year ago

Sometimes, full_sync can't access the outside world, that error can't then be sent to sentry.

C:\SPPNaut\SPPNAUT\SPPNaut\referentiel-sync>call .venv\Scripts\activate.bat 
2023-04-03 07:00:13 - INFO - File sync launched...
fatal error: Failed to connect to proxy URL: "http://squid.shom.fr:3128"
Traceback (most recent call last):
  File "full_sync.py", line 70, in <module>
    check=True,
  File "C:\soft\WinPython\python-3.7.6.amd64\lib\subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\SPPNaut\\SPPNAUT\\SPPNaut\\referentiel-sync\\.venv\\Scripts\\python.exe', '-m', 'awscli', 's3', 'sync', '\\\\smb-psm\\DATA_NA\\echanges-na\\referentiel', 's3://sppnaut-referentiel-production', '--delete', '--endpoint-url', 'https://cellar-fr-north-hds-c1.services.clever-cloud.com', '--exclude', '*', '--include', '[!.]*.eps', '--include', '**/[!.]*.eps', '--include', '[!.]*.pdf', '--include', '**/[!.]*.pdf', '--include', '[!.]*.xml', '--include', '**/[!.]*.xml', '--include', '[!.]*.xsl', '--include', '**/[!.]*.xsl', '--include', '[!.]*.svg', '--include', '**/[!.]*.svg']' returned non-zero exit status 1.
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit
2023-04-03 07:00:32 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002433D62CA88>: Failed to establish a new connection: [WinError 10061] Aucune connexion n’️a pu être é️tablie car l’️ordinateur cible l’️a expressé️ment refusé️e'))': /api/53/store/
Build step 'Exécuter une ligne de commande batch Windows' marked build as failure
Sending e-mails to: gael.roue@shom.fr
Finished: FAILURE

Could be monitored by Crons feature in Sentry if available in the future. cf. https://mattermost.incubateur.net/betagouv/pl/tzryjtn1dpf8fkf95b9arxoere