3 Replies Latest reply on Feb 24, 2016 10:49 AM by Matt Coles

    IOError in get_views()

    Sean Mullane

      We set up VizAlerts and had a successful test yesterday, but today it's consistently failing with the error message below:

       

      2016-02-24 00:00:51 - [DEBUG] - get_views - PostgreSQL repository returned 1 rows

      2016-02-24 00:00:51 - [DEBUG] - get_views - Checking rule with from: 0, to: 3600, timeout: 30

      2016-02-24 00:00:51 - [DEBUG] - get_views - Checking rule with from: 3601, to: 7200, timeout: 60

      2016-02-24 00:00:51 - [DEBUG] - get_views - Checking rule with from: 7201, to: 14400, timeout: 120

      2016-02-24 00:00:51 - [DEBUG] - get_views - Checking rule with from: 14401, to: 315360000, timeout: 300

      2016-02-24 00:00:51 - [DEBUG] - get_views - Rule applies!

      2016-02-24 00:00:51 - [DEBUG] - get_views - using timeout 300s, data retrieval tries 3, due to it being 32451.82 seconds since last run.

      2016-02-24 00:00:51 - [ERROR] - get_views - IOError accessing .\ops\vizalerts.state while getting views to process:

      2016-02-24 00:00:51 - [INFO] - send_email - sending email: <our email addresses>,None,None,ALERT: VizAlerts failed to execute properly,None

      2016-02-24 00:00:51 - [DEBUG] - send_email - email body: IOError accessing .\ops\vizalerts.state while getting views to process:

      2016-02-24 00:00:51 - [ERROR] - <module> - An unhandled exception occurred: Traceback (most recent call last):

        File "E:\VizAlerts\vizalerts.py", line 1249, in <module>

          main()

        File "E:\VizAlerts\vizalerts.py", line 175, in main

          views = get_views()

        File "E:\VizAlerts\vizalerts.py", line 459, in get_views

          quit_script(errormessage)

        File "E:\VizAlerts\vizalerts.py", line 868, in quit_script

          sys.exit(1)

      SystemExit: 1

      Traceback (most recent call last):

        File "E:\VizAlerts\vizalerts.py", line 1249, in <module>

          main()

        File "E:\VizAlerts\vizalerts.py", line 175, in main

          views = get_views()

        File "E:\VizAlerts\vizalerts.py", line 459, in get_views

          quit_script(errormessage)

        File "E:\VizAlerts\vizalerts.py", line 868, in quit_script

          sys.exit(1)

      SystemExit: 1

       

       

      This leads me to believe it's failing on the codecs.open() call in these lines (starting on line 446 of vizalerts.py):

          # write the next run times to file
          with codecs.open(statefile, encoding='utf-8', mode='w') as fw:
              fw.write('{}\t{}\t{}\t{}\t{}\t{}\t{}\n'.format("site_name", "subscription_id", "view_id",
                                                         "customized_view_id", "ran_last_at", "run_next_at",
                                                         "schedule_id"))
              for view in persistviews:
                  fw.write('{}\t{}\t{}\t{}\t{}\t{}\t{}\n'.format(view['site_name'], view["subscription_id"],
                                                                     view["view_id"], view["customized_view_id"],
                                                                     view["ran_last_at"], view["run_next_at"],
                                                                     view["schedule_id"]))

       

       

      Any idea why it would be failing here? I think it has the right location for the file, so maybe a permissions problem or the file wasn't closed properly at some point? At a glance, permissions look OK to open the file but since I'm not the sysadmin I'm not 100% sure.

      Thanks