Skip to content

Commit

Permalink
Use Azavea v0.13 of OTP; check feeds for errors.
Browse files Browse the repository at this point in the history
Closes #36.
  • Loading branch information
flibbertigibbet committed Feb 24, 2015
1 parent efdc868 commit 3e25ea0
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Development Installation
------------------------

1. Make sure you have the development dependencies installed
2. Place `septa_bus.zip`, `septa_rail.zip`, and `patco.zip` in the gtfs folder
2. Place `septa_bus.zip`, `septa_rail.zip`, and `patco.zip` in the otp_data folder
3. Run `vagrant up`
4. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
5. Running `gulp watch` from `/opt/app/src` will automatically collect static files together when changes are detected for Django template consumption.
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
#otp_data_dir: /var/otp
otp_osm_source: https://s3.amazonaws.com/metro-extracts.mapzen.com/philadelphia_pennsylvania.osm.pbf
otp_osm_filename: /var/otp/philadelphia.osm.pbf
otp_repo: "https://github.com/azavea/OpenTripPlanner.git"
otp_version: "develop"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ignore files in this directory
*
# Except .gitignore
!.gitignore
!.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/python

# Check GTFS feeds have no errors and are current, using feedvalidator.py

import os
import subprocess
import sys

def validate_feed(feed_file):
print("Validating GTFS %s..." % feed_file)
p = subprocess.Popen(['feedvalidator.py', '--output=CONSOLE',
'-m', '-n', feed_file], stdout=subprocess.PIPE)
out = p.communicate()
res = out[0].split('\n')
for ln in res:
print(ln)
# find output line with count of errors/warnings
errct = res[-2:-1][0]
if errct.find('error') > -1:
print("Feed validator found errors in " + feed_file + ": " + errct + ".")
sys.exit(1)
elif out[0].find('this feed is in the future,') > -1:
print("Feed validator found GTFS not in service until future.")
sys.exit(2)
elif out[0].find('feed expired on') > -1:
print("Feed validator found GTFS has expired.")
sys.exit(3)
else:
if errct.find('successfully') > -1:
print("Feed looks great: " + errct + ".")
else:
# have warnings
print("Feed " + feed_file + " looks ok: " + errct[7:] + ".")

# validate all zip files in current directory as GTFS
for p, ds, fs in os.walk('.'):
for f in fs:
if f.endswith('.zip'):
validate_feed(os.path.join(p, f))
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
- name: Validate GTFS
command: feedvalidator.py -m -o CONSOLE {{ otp_data_dir }}/{{ item }}.zip
with_items: otp_gtfs_sources
register: command_result
failed_when: "'This feed expired on' in command_result.stdout or
'this feed is in the future,' in command_result.stdout"
notify: Build OTP Graph
command: python validate_feed.py
args:
chdir: "{{ otp_data_dir }}"

- name: Build OTP Graph
command: "{{ otp_bin_dir }}/build-old {{ otp_data_dir }}/graph-config.xml
chdir={{ otp_bin_dir }}"
command: /usr/bin/java -Xmx{{ otp_process_mem }} -jar {{ otp_jarfile }} --build {{ otp_data_dir }}
args:
chdir: "{{ otp_bin_dir }}"
notify: Restart OpenTripPlanner
13 changes: 6 additions & 7 deletions deployment/ansible/roles/cac-tripplanner.otp-data/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
- name: Create Directory for OSM and GTFS
file: path={{ otp_data_dir }} state=directory

- name: Download Philadelphia OSM Data
get_url: url={{ otp_osm_source }}
dest={{ otp_osm_filename }}
notify: Build OTP Graph
- name: Copy Feed Validator
copy: src=validate_feed.py dest="{{ otp_data_dir }}"

- name: Copy OTP Data
copy: src=./ dest="{{ otp_data_dir }}/" owner={{ansible_ssh_user}} group={{ansible_ssh_user}} mode=0664
copy: src=./otp_data/ dest="{{ otp_data_dir }}/" owner={{ansible_ssh_user}} group={{ansible_ssh_user}} mode=0664
notify: Validate GTFS

- name: Save graph-config.xml
template: src=graph-config.xml.j2 dest={{ otp_data_dir }}/graph-config.xml
- name: Download Philadelphia OSM Data
get_url: url={{ otp_osm_source }}
dest={{ otp_osm_filename }}
notify: Build OTP Graph
1 change: 0 additions & 1 deletion gtfs

This file was deleted.

1 change: 1 addition & 0 deletions otp_data

0 comments on commit 3e25ea0

Please sign in to comment.