SlideShare una empresa de Scribd logo
1 de 49
Vic Levy
Princeton Consultants, Inc.
590 5th Ave, Floor 16
New York, NY
vlevy@princeton.com
Python on Rails
Advancing Safety with Locomotive-Hosted
“Mobile” App
NYC Python Meetup, April 17, 2014
Two Sigma Investments, LLC, New York, NY
1
Outline
Positive Train Control 101
2
COSMA: Agent on the locomotive
Programming COSMA
Testing
Positive Train Control 101
3
PTC is a federal law applying to Amtrak and
Class-I railroads.
CSX is a Class-I railroad.
4
5
• Chatsworth, CA, Sept 2008. Commuter
and freight trains collide, many
casualties
• Federal law passed same month
• Class-1 railroads due Dec 2015
Warns crew when any of several classes
of danger detected 6
If crew does not react to warning in
time, PTC applies brakes 7
Impact of PTC on Class-I
Railroads, Including CSX
• New back-office servers
• New wayside devices
• New communications systems
8
Impact of PTC on Class-I
Railroads, Including CSX, Cont’d
• New equipment on board locomotives
9
New PTC Equipment Aboard CSX
Locomotives: PTC Computer
10
New PTC Equipment Aboard CSX
Locomotives: Computer Displays
11
New PTC Equipment Aboard CSX
Locomotives: 220-MHz Radio 12
New PTC Equipment Aboard CSX
Locomotives: Onboard Routing Server
COSMA host system
13
New PTC Equipment Aboard CSX
Locomotives
NEED: Checkout, monitor, upgrade
these devices and more
14
COSMA: Agent on the
Locomotive
15
COSMA: CSX Onboard Systems
Management Agent 16
Python
COSMA Primary Functions
1. Check out PTC equipment before
deployment in the field
17
COSMA Primary Functions, Cont’d
2. Report on conditions, problems,
assets in the onboard PTC
environment
3. Correct problems, either
autonomously or on command
18
COSMA Primary Functions, Cont’d
4. Report on cell, radio and Wifi signal
strength
19
COSMA Primary Functions, Cont’d
5. Perform software updates to onboard
systems, either in the shop or on the rail
20
Programming COSMA
21
Realities of Programming in the
Locomotive Environment
1. ?
22
Realities of Programming in the
Locomotive Environment
1. No interfering with proper functioning of
safety-critical systems
2. In and out of connectivity
3. No controlled shutdown (circuit breaker)
4. Cell bandwidth is expensive
5. Limited writing to persistent storage (SSD)
23
Realities of Programming in the
Locomotive Environment, Cont’d
6. Stay aware of changes in the onboard
environment
• Did we wake up on another locomotive?
• Are we in home territory?
• What is the PTC state?
24
Realities of Programming in the
Locomotive Environment, Cont’d
7. Python 2.6.6
8. Red Hat Enterprise Linux Server 6.2
25
COSMA Is Multi-Threaded
• Most thread asleep most of the time
• Wake up, check something, go back to sleep
• Signal-mapping watches GPS for distance
26
Two Configuration Files:
27
Default (installed) Override (runtime)
Two Configuration Files
(ConfigParser Library) 28
Pattern: JIT Configuration Queries
Application is remotely configurable, so
no caching configs in __init__
29
Pattern: Subsystem Query
30Don’t overtax onboard systems if
recently sampled data is good enough
Pattern: Logical Device
• Adapter pattern presents a common
interface to business code querying
devices with differing access
methods
31
Pattern: No Self-Deprecating or
Humorous Comments 32
Hardware Access Method: UDP
 Nonintrusive read, no impact on
monitored device
 Monitored device must be broadcasting
 Sample rate determined by device
33
Hardware Access Method: UDP
34• How to create a UDP socket depends on
whether sending or receiving, or
receiving a broadcast
Hardware Access Method: SNMP
• Available library: netsnmp
• Faster
• Malformed OID can crash Python
• Available library: pysnmp
• Pure-Python implementation
• Slower
• Unresponsive OID returns “NO DATA”
35
Hardware Access Method: SNMP
Example pt 1: Create netsnmp session 36
Hardware Access Method: SNMP
Example pt 2: Create a list of bindings 37
Hardware Access Method: SNMP
Example pt 3: Query and recombine 38
HardwareAccessMethod:
SmartCtl
39
[vlevy@CSX-PTC3EAP-111100016 ~]$ sudo smartctl -a /dev/sda
[sudo] password for vlevy:
smartctl 5.39.1 2010-01-28 r3054 [i386-redhat-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: FiD 2.5 SATA10000
Serial Number: 20111005AAB000000030
Firmware Version: 090928
User Capacity: 7,998,455,808 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Mon Apr 14 15:11:12 2014 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Total time to complete Offline
data collection: ( 0) seconds.
Offline data collection
capabilities: (0x00) Offline data collection not supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x00) Error logging NOT supported.
No General Purpose Logging support.
SMART Attributes Data Structure revision number: 1280
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 331
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 0
194 Temperature_Celsius 0x0007 032 100 000 Pre-fail Always - 0
229 Unknown_Attribute 0x0002 100 000 000 Old_age Always - 259865206445036
232 Available_Reservd_Space 0x0002 100 048 000 Old_age Always - 9037453799481
233 Media_Wearout_Indicator 0x0002 100 000 000 Old_age Always - 0
234 Unknown_Attribute 0x0002 100 000 000 Old_age Always - 678655194114
235 Unknown_Attribute 0x0002 100 000 000 Old_age Always - 4261534239
Warning: device does not support Error Logging
SMART Error Log Version: 16
No Errors Logged
Warning: device does not support Self Test Logging
SMART Self-test log structure revision number 16
Warning: ATA Specification requires self-test log structure revision number = 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
Device does not support Selective Self Tests/Logging
SSD Statistics:
• Power cycle count
• Erase cycle
percent
• Average & max
erase count
Technique:
• Parse to int
• struct pack &
unpack
Hardware Access Method: Drive
Vendor and Model 40
More Hardware Access Methods
• SSH
• Telnet
41
Development & Testing
Environments
42
Development: Eclipse & Pydev
43
Unit Testing: unittest Library
44Eclipse & Pydev rock. Also nosetests.
Testing Platforms: Lab 45
Testing Platforms: High-Rail 46
Testing Platforms: The Real Thing 47
Vic Levy
vlevy@princeton.com
Princeton Consultants, Inc.
590 5th Ave, Floor 16
New York, NY
Happy Springtime! 1
Princeton Consultants, Inc.
• Blend of information-technology and management consulting
• Service offerings are business strategy, software
development, process engineering and project management
• Clients include many of the best-known and most innovative
companies
• 85 full-time, on-shore professionals work out of our offices in
Princeton, N.J. and Midtown Manhattan
• Over 1,500 projects successfully delivered since our founding
in 1980
• Corporate website: www.princeton.com
• Careers website: www.princeton.com/join
2 Research Way
Princeton, NJ 08540
590 Fifth Avenue
New York, NY 10036

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

BKK16-502 Suspend to Idle
BKK16-502 Suspend to IdleBKK16-502 Suspend to Idle
BKK16-502 Suspend to Idle
 
Kernel Recipes 2015: Speed up your kernel development cycle with QEMU
Kernel Recipes 2015: Speed up your kernel development cycle with QEMUKernel Recipes 2015: Speed up your kernel development cycle with QEMU
Kernel Recipes 2015: Speed up your kernel development cycle with QEMU
 
Embedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Introduction to JTAG debuggingEmbedded Recipes 2019 - Introduction to JTAG debugging
Embedded Recipes 2019 - Introduction to JTAG debugging
 
SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016
 
BKK16-304 The State of GDB on AArch64
BKK16-304 The State of GDB on AArch64BKK16-304 The State of GDB on AArch64
BKK16-304 The State of GDB on AArch64
 
Dynamic user trace
Dynamic user traceDynamic user trace
Dynamic user trace
 
Programming embedded systems ii
Programming embedded systems iiProgramming embedded systems ii
Programming embedded systems ii
 
BKK16-303 96Boards - TV Platform
BKK16-303 96Boards - TV PlatformBKK16-303 96Boards - TV Platform
BKK16-303 96Boards - TV Platform
 
Ixiaexplorer
IxiaexplorerIxiaexplorer
Ixiaexplorer
 
Static partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-VStatic partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-V
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
 
Klessydra-T: Designing Configurable Vector Co-Processors for Multi-Threaded E...
Klessydra-T: Designing Configurable Vector Co-Processors for Multi-Threaded E...Klessydra-T: Designing Configurable Vector Co-Processors for Multi-Threaded E...
Klessydra-T: Designing Configurable Vector Co-Processors for Multi-Threaded E...
 
An Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource PartitioningAn Essential Relationship between Real-time and Resource Partitioning
An Essential Relationship between Real-time and Resource Partitioning
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
 
Understanding and Improving Device Access Complexity
Understanding and Improving Device Access ComplexityUnderstanding and Improving Device Access Complexity
Understanding and Improving Device Access Complexity
 
RISC-V NOEL-V - A new high performance RISC-V Processor Family
RISC-V NOEL-V - A new high performance RISC-V Processor FamilyRISC-V NOEL-V - A new high performance RISC-V Processor Family
RISC-V NOEL-V - A new high performance RISC-V Processor Family
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
 
MIPI DevCon 2016: Versatile Software Solution for MIPI C-PHY TX Testing
MIPI DevCon 2016: Versatile Software Solution for MIPI C-PHY TX TestingMIPI DevCon 2016: Versatile Software Solution for MIPI C-PHY TX Testing
MIPI DevCon 2016: Versatile Software Solution for MIPI C-PHY TX Testing
 
ThesisPresentation_Upd
ThesisPresentation_UpdThesisPresentation_Upd
ThesisPresentation_Upd
 
DPDK Summit 2015 - Intel - Keith Wiles
DPDK Summit 2015 - Intel - Keith WilesDPDK Summit 2015 - Intel - Keith Wiles
DPDK Summit 2015 - Intel - Keith Wiles
 

Similar a Python on Rails - Victory Levy

BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...
BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...
BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...
aaajjj4
 
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdfBRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
aaajjj4
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
sean chen
 
STS _ TLF 2014 IDT
STS _ TLF 2014 IDTSTS _ TLF 2014 IDT
STS _ TLF 2014 IDT
Hank Lydick
 
The Next Step of OpenStack Evolution for NFV Deployments
The Next Step ofOpenStack Evolution for NFV DeploymentsThe Next Step ofOpenStack Evolution for NFV Deployments
The Next Step of OpenStack Evolution for NFV Deployments
Dirk Kutscher
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overview
Linaro
 

Similar a Python on Rails - Victory Levy (20)

BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...
BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...
BRKDCT-3144 - Advanced - Troubleshooting Cisco Nexus 7000 Series Switches (20...
 
We will charge you. How to [b]reach vendor’s network using EV charging station.
We will charge you. How to [b]reach vendor’s network using EV charging station.We will charge you. How to [b]reach vendor’s network using EV charging station.
We will charge you. How to [b]reach vendor’s network using EV charging station.
 
Docker Monitoring Webinar
Docker Monitoring  WebinarDocker Monitoring  Webinar
Docker Monitoring Webinar
 
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdfBRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
 
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
 
Introduction to architecture exploration
Introduction to architecture explorationIntroduction to architecture exploration
Introduction to architecture exploration
 
6 profiling tools
6 profiling tools6 profiling tools
6 profiling tools
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
 
STS _ TLF 2014 IDT
STS _ TLF 2014 IDTSTS _ TLF 2014 IDT
STS _ TLF 2014 IDT
 
BRKRST-3068 Troubleshooting Catalyst 2K and 3K.pdf
BRKRST-3068  Troubleshooting Catalyst 2K and 3K.pdfBRKRST-3068  Troubleshooting Catalyst 2K and 3K.pdf
BRKRST-3068 Troubleshooting Catalyst 2K and 3K.pdf
 
The Next Step of OpenStack Evolution for NFV Deployments
The Next Step ofOpenStack Evolution for NFV DeploymentsThe Next Step ofOpenStack Evolution for NFV Deployments
The Next Step of OpenStack Evolution for NFV Deployments
 
uCluster
uClusteruCluster
uCluster
 
Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?Blackhat USA 2016 - What's the DFIRence for ICS?
Blackhat USA 2016 - What's the DFIRence for ICS?
 
Kernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologiesKernel Recipes 2015: Kernel packet capture technologies
Kernel Recipes 2015: Kernel packet capture technologies
 
Black Hat USA 2022 - Arsenal Labs - Vehicle Control Systems - Red vs Blue
Black Hat USA 2022 - Arsenal Labs - Vehicle Control Systems - Red vs BlueBlack Hat USA 2022 - Arsenal Labs - Vehicle Control Systems - Red vs Blue
Black Hat USA 2022 - Arsenal Labs - Vehicle Control Systems - Red vs Blue
 
Alessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocolAlessio Lama - Development and testing of a safety network protocol
Alessio Lama - Development and testing of a safety network protocol
 
The constrained application protocol (co ap) implementation-part4-1
The constrained application protocol (co ap) implementation-part4-1The constrained application protocol (co ap) implementation-part4-1
The constrained application protocol (co ap) implementation-part4-1
 
Training Slides: Basics 104: Simple Tungsten Clustering Deployments
Training Slides: Basics 104: Simple Tungsten Clustering DeploymentsTraining Slides: Basics 104: Simple Tungsten Clustering Deployments
Training Slides: Basics 104: Simple Tungsten Clustering Deployments
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overview
 
Spectre meltdown performance_tests - v0.3
Spectre meltdown performance_tests - v0.3Spectre meltdown performance_tests - v0.3
Spectre meltdown performance_tests - v0.3
 

Más de Hakka Labs

Más de Hakka Labs (20)

Always Valid Inference (Ramesh Johari, Stanford)
Always Valid Inference (Ramesh Johari, Stanford)Always Valid Inference (Ramesh Johari, Stanford)
Always Valid Inference (Ramesh Johari, Stanford)
 
DataEngConf SF16 - High cardinality time series search
DataEngConf SF16 - High cardinality time series searchDataEngConf SF16 - High cardinality time series search
DataEngConf SF16 - High cardinality time series search
 
DataEngConf SF16 - Data Asserts: Defensive Data Science
DataEngConf SF16 - Data Asserts: Defensive Data ScienceDataEngConf SF16 - Data Asserts: Defensive Data Science
DataEngConf SF16 - Data Asserts: Defensive Data Science
 
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast DataDatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
 
DataEngConf SF16 - Recommendations at Instacart
DataEngConf SF16 - Recommendations at InstacartDataEngConf SF16 - Recommendations at Instacart
DataEngConf SF16 - Recommendations at Instacart
 
DataEngConf SF16 - Running simulations at scale
DataEngConf SF16 - Running simulations at scaleDataEngConf SF16 - Running simulations at scale
DataEngConf SF16 - Running simulations at scale
 
DataEngConf SF16 - Deriving Meaning from Wearable Sensor Data
DataEngConf SF16 - Deriving Meaning from Wearable Sensor DataDataEngConf SF16 - Deriving Meaning from Wearable Sensor Data
DataEngConf SF16 - Deriving Meaning from Wearable Sensor Data
 
DataEngConf SF16 - Collecting and Moving Data at Scale
DataEngConf SF16 - Collecting and Moving Data at Scale DataEngConf SF16 - Collecting and Moving Data at Scale
DataEngConf SF16 - Collecting and Moving Data at Scale
 
DataEngConf SF16 - BYOMQ: Why We [re]Built IronMQ
DataEngConf SF16 - BYOMQ: Why We [re]Built IronMQDataEngConf SF16 - BYOMQ: Why We [re]Built IronMQ
DataEngConf SF16 - BYOMQ: Why We [re]Built IronMQ
 
DataEngConf SF16 - Unifying Real Time and Historical Analytics with the Lambd...
DataEngConf SF16 - Unifying Real Time and Historical Analytics with the Lambd...DataEngConf SF16 - Unifying Real Time and Historical Analytics with the Lambd...
DataEngConf SF16 - Unifying Real Time and Historical Analytics with the Lambd...
 
DataEngConf SF16 - Three lessons learned from building a production machine l...
DataEngConf SF16 - Three lessons learned from building a production machine l...DataEngConf SF16 - Three lessons learned from building a production machine l...
DataEngConf SF16 - Three lessons learned from building a production machine l...
 
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at PinterestDataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
 
DataEngConf SF16 - Bridging the gap between data science and data engineering
DataEngConf SF16 - Bridging the gap between data science and data engineeringDataEngConf SF16 - Bridging the gap between data science and data engineering
DataEngConf SF16 - Bridging the gap between data science and data engineering
 
DataEngConf SF16 - Multi-temporal Data Structures
DataEngConf SF16 - Multi-temporal Data StructuresDataEngConf SF16 - Multi-temporal Data Structures
DataEngConf SF16 - Multi-temporal Data Structures
 
DataEngConf SF16 - Entity Resolution in Data Pipelines Using Spark
DataEngConf SF16 - Entity Resolution in Data Pipelines Using SparkDataEngConf SF16 - Entity Resolution in Data Pipelines Using Spark
DataEngConf SF16 - Entity Resolution in Data Pipelines Using Spark
 
DataEngConf SF16 - Beginning with Ourselves
DataEngConf SF16 - Beginning with OurselvesDataEngConf SF16 - Beginning with Ourselves
DataEngConf SF16 - Beginning with Ourselves
 
DataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
DataEngConf SF16 - Routing Billions of Analytics Events with High DeliverabilityDataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
DataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
 
DataEngConf SF16 - Tales from the other side - What a hiring manager wish you...
DataEngConf SF16 - Tales from the other side - What a hiring manager wish you...DataEngConf SF16 - Tales from the other side - What a hiring manager wish you...
DataEngConf SF16 - Tales from the other side - What a hiring manager wish you...
 
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
DataEngConf SF16 - Methods for Content Relevance at LinkedInDataEngConf SF16 - Methods for Content Relevance at LinkedIn
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
 
DataEngConf SF16 - Spark SQL Workshop
DataEngConf SF16 - Spark SQL WorkshopDataEngConf SF16 - Spark SQL Workshop
DataEngConf SF16 - Spark SQL Workshop
 

Último

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Último (20)

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 

Python on Rails - Victory Levy

  • 1. Vic Levy Princeton Consultants, Inc. 590 5th Ave, Floor 16 New York, NY vlevy@princeton.com Python on Rails Advancing Safety with Locomotive-Hosted “Mobile” App NYC Python Meetup, April 17, 2014 Two Sigma Investments, LLC, New York, NY 1
  • 2. Outline Positive Train Control 101 2 COSMA: Agent on the locomotive Programming COSMA Testing
  • 4. PTC is a federal law applying to Amtrak and Class-I railroads. CSX is a Class-I railroad. 4
  • 5. 5 • Chatsworth, CA, Sept 2008. Commuter and freight trains collide, many casualties • Federal law passed same month • Class-1 railroads due Dec 2015
  • 6. Warns crew when any of several classes of danger detected 6
  • 7. If crew does not react to warning in time, PTC applies brakes 7
  • 8. Impact of PTC on Class-I Railroads, Including CSX • New back-office servers • New wayside devices • New communications systems 8
  • 9. Impact of PTC on Class-I Railroads, Including CSX, Cont’d • New equipment on board locomotives 9
  • 10. New PTC Equipment Aboard CSX Locomotives: PTC Computer 10
  • 11. New PTC Equipment Aboard CSX Locomotives: Computer Displays 11
  • 12. New PTC Equipment Aboard CSX Locomotives: 220-MHz Radio 12
  • 13. New PTC Equipment Aboard CSX Locomotives: Onboard Routing Server COSMA host system 13
  • 14. New PTC Equipment Aboard CSX Locomotives NEED: Checkout, monitor, upgrade these devices and more 14
  • 15. COSMA: Agent on the Locomotive 15
  • 16. COSMA: CSX Onboard Systems Management Agent 16 Python
  • 17. COSMA Primary Functions 1. Check out PTC equipment before deployment in the field 17
  • 18. COSMA Primary Functions, Cont’d 2. Report on conditions, problems, assets in the onboard PTC environment 3. Correct problems, either autonomously or on command 18
  • 19. COSMA Primary Functions, Cont’d 4. Report on cell, radio and Wifi signal strength 19
  • 20. COSMA Primary Functions, Cont’d 5. Perform software updates to onboard systems, either in the shop or on the rail 20
  • 22. Realities of Programming in the Locomotive Environment 1. ? 22
  • 23. Realities of Programming in the Locomotive Environment 1. No interfering with proper functioning of safety-critical systems 2. In and out of connectivity 3. No controlled shutdown (circuit breaker) 4. Cell bandwidth is expensive 5. Limited writing to persistent storage (SSD) 23
  • 24. Realities of Programming in the Locomotive Environment, Cont’d 6. Stay aware of changes in the onboard environment • Did we wake up on another locomotive? • Are we in home territory? • What is the PTC state? 24
  • 25. Realities of Programming in the Locomotive Environment, Cont’d 7. Python 2.6.6 8. Red Hat Enterprise Linux Server 6.2 25
  • 26. COSMA Is Multi-Threaded • Most thread asleep most of the time • Wake up, check something, go back to sleep • Signal-mapping watches GPS for distance 26
  • 27. Two Configuration Files: 27 Default (installed) Override (runtime)
  • 29. Pattern: JIT Configuration Queries Application is remotely configurable, so no caching configs in __init__ 29
  • 30. Pattern: Subsystem Query 30Don’t overtax onboard systems if recently sampled data is good enough
  • 31. Pattern: Logical Device • Adapter pattern presents a common interface to business code querying devices with differing access methods 31
  • 32. Pattern: No Self-Deprecating or Humorous Comments 32
  • 33. Hardware Access Method: UDP  Nonintrusive read, no impact on monitored device  Monitored device must be broadcasting  Sample rate determined by device 33
  • 34. Hardware Access Method: UDP 34• How to create a UDP socket depends on whether sending or receiving, or receiving a broadcast
  • 35. Hardware Access Method: SNMP • Available library: netsnmp • Faster • Malformed OID can crash Python • Available library: pysnmp • Pure-Python implementation • Slower • Unresponsive OID returns “NO DATA” 35
  • 36. Hardware Access Method: SNMP Example pt 1: Create netsnmp session 36
  • 37. Hardware Access Method: SNMP Example pt 2: Create a list of bindings 37
  • 38. Hardware Access Method: SNMP Example pt 3: Query and recombine 38
  • 39. HardwareAccessMethod: SmartCtl 39 [vlevy@CSX-PTC3EAP-111100016 ~]$ sudo smartctl -a /dev/sda [sudo] password for vlevy: smartctl 5.39.1 2010-01-28 r3054 [i386-redhat-linux-gnu] (local build) Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net === START OF INFORMATION SECTION === Device Model: FiD 2.5 SATA10000 Serial Number: 20111005AAB000000030 Firmware Version: 090928 User Capacity: 7,998,455,808 bytes Device is: Not in smartctl database [for details use: -P showall] ATA Version is: 7 ATA Standard is: Exact ATA specification draft version not indicated Local Time is: Mon Apr 14 15:11:12 2014 EDT SMART support is: Available - device has SMART capability. SMART support is: Enabled === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED General SMART Values: Offline data collection status: (0x00) Offline data collection activity was never started. Auto Offline Data Collection: Disabled. Total time to complete Offline data collection: ( 0) seconds. Offline data collection capabilities: (0x00) Offline data collection not supported. SMART capabilities: (0x0003) Saves SMART data before entering power-saving mode. Supports SMART auto save timer. Error logging capability: (0x00) Error logging NOT supported. No General Purpose Logging support. SMART Attributes Data Structure revision number: 1280 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 331 9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 0 194 Temperature_Celsius 0x0007 032 100 000 Pre-fail Always - 0 229 Unknown_Attribute 0x0002 100 000 000 Old_age Always - 259865206445036 232 Available_Reservd_Space 0x0002 100 048 000 Old_age Always - 9037453799481 233 Media_Wearout_Indicator 0x0002 100 000 000 Old_age Always - 0 234 Unknown_Attribute 0x0002 100 000 000 Old_age Always - 678655194114 235 Unknown_Attribute 0x0002 100 000 000 Old_age Always - 4261534239 Warning: device does not support Error Logging SMART Error Log Version: 16 No Errors Logged Warning: device does not support Self Test Logging SMART Self-test log structure revision number 16 Warning: ATA Specification requires self-test log structure revision number = 1 No self-tests have been logged. [To run self-tests, use: smartctl -t] Device does not support Selective Self Tests/Logging SSD Statistics: • Power cycle count • Erase cycle percent • Average & max erase count Technique: • Parse to int • struct pack & unpack
  • 40. Hardware Access Method: Drive Vendor and Model 40
  • 41. More Hardware Access Methods • SSH • Telnet 41
  • 44. Unit Testing: unittest Library 44Eclipse & Pydev rock. Also nosetests.
  • 47. Testing Platforms: The Real Thing 47
  • 48. Vic Levy vlevy@princeton.com Princeton Consultants, Inc. 590 5th Ave, Floor 16 New York, NY Happy Springtime! 1
  • 49. Princeton Consultants, Inc. • Blend of information-technology and management consulting • Service offerings are business strategy, software development, process engineering and project management • Clients include many of the best-known and most innovative companies • 85 full-time, on-shore professionals work out of our offices in Princeton, N.J. and Midtown Manhattan • Over 1,500 projects successfully delivered since our founding in 1980 • Corporate website: www.princeton.com • Careers website: www.princeton.com/join 2 Research Way Princeton, NJ 08540 590 Fifth Avenue New York, NY 10036