-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Azavea v0.13 of OTP; check feeds for errors.
Closes #36.
- Loading branch information
1 parent
efdc868
commit 3e25ea0
Showing
8 changed files
with
57 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ripplanner.otp-data/files/gtfs/.gitignore → ...lanner.otp-data/files/otp_data/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Ignore files in this directory | ||
* | ||
# Except .gitignore | ||
!.gitignore | ||
!.gitignore |
39 changes: 39 additions & 0 deletions
39
deployment/ansible/roles/cac-tripplanner.otp-data/files/validate_feed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
15 changes: 7 additions & 8 deletions
15
deployment/ansible/roles/cac-tripplanner.otp-data/handlers/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deployment/ansible/roles/cac-tripplanner.otp-data/files/otp_data/ |