bradleya / pi-display Goto Github PK
View Code? Open in Web Editor NEWDisplays are Pimoroni Blinkt, Scroll-pHAT, and Scroll-pHAT-HD connected to Raspberry Pi 3 using Triple GPIO Multiplexing Expansion Board
License: MIT License
Displays are Pimoroni Blinkt, Scroll-pHAT, and Scroll-pHAT-HD connected to Raspberry Pi 3 using Triple GPIO Multiplexing Expansion Board
License: MIT License
create-message.sh add error code
|| error can not mkdir ${DATA_DIR}${CLUSTER}
|| error can not create host file
display-message.py reread data file at the beginning of each loop
it is current not clearing the buffer like scrollphat-hd
./create-message.sh support scale and performance
redesign create-message/sh to decrease the amount of time it takes to complete
change the first loop to start a docker container or script.sh on each host in SYSTEMS list but do not wait for the container or script to complete before starting the container or script on the next host. That way each the container or script will run in ~parallel.
Will need a method for the second loop to determine if the first container or script has completed. (test with 1 or 2 host then test with all hosts)
or use a temp file for the new information and when the container or script is complete then update data/cluster/host file with the new information so when the second loop pull information it is always complete
Move to a docker container because the docker container will support failover restart process ...
--rm
pi-display/main/test2/display-led.py
read host information from /usr/local/data/${CLUSTER}/${HOST} and display on blinkt
install in create-message.sh ; check all required directories if NOT create / error ; check for install files in default directories if NOT create / error
-d /usr/local/bin 2) 3)
-d /usr/local/data
-d /usr/local/data/${CLUSTER}
A) set crontab or at 2)
B)
display-led.py determine script run time to determine sleep time before exit
Need to write this in python
# Set START_TIME
START_TIME=`date +%Y%m%d%H%M%S
# Set end time
END_TIME=`date +%Y%m%d%H%M%S`
# calucate run time
RUN_TIME=$(expr ${END_TIME} - ${START_TIME})
echo "${START_TIME} ${END_TIME}"
expr 15 - (${END_TIME} - ${START_TIME})
scrollphat/display-message.py add argument
CLUSTER=${1:-cluster-1}
ADMUSER=${2:-${USER}}
DATA_DIR=${3:-/usr/local/data/}
scrollphathd/display-message-hd.py
display-message.py Change echo or print DEBUG INFO WARNING ERROR
create-message.sh add display_help for environment variables
display-led.py
check-markit 134 [INFO]: /usr/local/bin/display-led.py release 3.141.283, commit date 2018-09-22_13:30:59_CDT
Traceback (most recent call last):
File "/usr/local/bin/display-led.py", line 89, in
FILE_NAME = DATA_DIR + CLUSTER + FILE_NAME
TypeError: Can't convert 'bytes' object to str implicitly
display-message-hd.py reread data file at the beginning of each loop
create-message.sh support environment variables
CLUSTER
DATA_DIR
create-message.sh
The information in MESSAGE file is sent to remote systems before it has been updated. This means remote systems with Scroll-pHAT will display the previous MESSAGE information. Thus systems with Scroll-pHAT will display the previous MESSAGE information.
Add a new loop to scp MESSAGE file to remote hosts after MESSAGE file has been completed . This will display current information on remote systems with Scroll-pHAT vers previous copy of MESSAGE.
create-message.sh
server six create-message.sh creates correct docker information in four-rpi3B.cptx86.com on six (Running 1) but when create-message.sh copied the file (four-rpi3b.cptx86.com) from six to four the wrong docker information is copied to four-rpi3b.cptx86.com on host four-rpi3b (Running 0)
create-message.sh
Add environment variable support for SYSTEMS variable so site can select a different file name other than SYSTEMS
display-message-hd.py not logging to /tmp while running test in crontab
display-led.py Change echo or print DEBUG INFO WARNING ERROR
• When - Date and Time (UTC)1 Event Occurred
• What - Software Application & version, Command, OS version, log level, PID, PPID
• Where - GPS Location, MAC Address, Gateway, Source and Destination IP, Port, VM ID, Container ID, Image ID, Host ID, Data Center Row and Rack location, Data Center Geo-location
• Who2 - UID, GID, Customer ID, Transaction ID, cart ID
• Message - Text Message including incident level
display-led.py needs more adding template.py
../scrollphat/display-message.py
echo $CLUSTER
export CLUSTER='us-west1'
echo $CLUSTER
unset CLUSTER
echo $CLUSTER
Use the -n option with export")
print ("to remove the exported information from the CLUSTER environment variable;")
print ("export -n CLUSTER. Setting an environment variable to be defined at login")
print ("by adding it to ~/.bashrc file or you can just modify the script with your")
print ("default location for DATA_DIR, CLUSTER, and MESSAGE_FILE. You are on your")
print ("own defining environment variables if you are using other shells.")
create-message.sh test source ~/.profile line in crontab
source ~/.profile
../scrollphat/display-message.py correct display_help
change to unset CLUSTER not export -n CLUSTER
change --> create soft link <-- to define which FQDN is current cluster server
remove Usage in labels from echo statements because it will reduce the output, speed scroll, and has no value
display-message-hd.py test if require splitlines() is required or if rstrip('\n') is ok
sample of code below
# Check argument 1 for non-default MESSAGEHD file
if no_arguments == 2 :
MESSAGEHD_file = sys.argv[1]
if DEBUG == 1 : print ("> {}DEBUG{} {} {} Using MESSAGEHD file >{}<".format(color.BOLD, color.END, get_line_no(), get_date_stamp(), MESSAGEHD_file))
else :
if DEBUG == 1 : print ("> {}DEBUG{} {} {} Using MESSAGEHD file >{}<".format(color.BOLD, color.END, get_line_no(), get_date_stamp(), MESSAGEHD_file))
# Read TEMP_FILE contents and return contents
def get_msg(TEMP_FILE) :
if DEBUG == 1 : print ("> {}DEBUG{} {} {} Reading MESSAGE file >{}<".format(color.BOLD, color.END, get_line_no(), get_date_stamp(), TEMP_FILE))
file = open(TEMP_FILE,"r")
CONTENT = file.read()
file.close()
CONTENT = CONTENT.rstrip('\n')
return CONTENT
create-message.sh environment support MESSAGE file
add help-message.py code into display-message.py
display-message-hd.py add support for environment variables
MESSAGEHD_file = "/usr/local/data/us-tx-cluster-1/MESSAGEHD"
about line 80
create-message.sh add MESSAGE-HD file for scrollphathd
Is there a way to monitor the number of times per minutes the red LED blinkts?
pi-display/main/test2/display-led.py display on blinkt
=> notes <
check if VISUAL is set to editor
env | grep -i visual
source ~/.bashrc
sudo vi /etc/cron.allow
add user name approved to add to crontab
uadmin
crontab -e
add line below to file
*/2 * * * * /usr/local/bin/display-led.py >> /tmp/crontab-test-log-file 2>&1
display-message.py
need to understand which get_msg is better example 1 or example 2
once determined update template.py
Control GPIO with Docker Swarm
https://blog.alexellis.io/gpio-on-swarm/
Control GPIO with Docker Swarm
https://therobotacademy.com/feed/control-gpio-docker-swarm
https://github.com/alexellis/docker-blinkt-workshop/blob/master/3-BLINKT.md
add main/test1/create-message.sh memory for CPU and GPU include in log
maybe try: vcgencmd get_mem arm && vcgencmd get_mem gpu: Shows the memory split between the CPU and GPU
create-message.sh
Looks like scp and ssh is not using SSHPORT
the second question
should I use .ssh/config instead of argument 4
THis looks like a bug just need to test so more
create-message.sh
Change the design to support running create-message.sh on any system in a cluster, not just the system in the cluster that has a scroll phat. Systems fail! To support an SRE environment of automation and failover
Change echo or print DEBUG INFO WARNING ERROR
• When - Date and Time (UTC)1 Event Occurred
• What - Software Application & version, Command, OS version, log level, PID, PPID
• Where - GPS Location, MAC Address, Gateway, Source and Destination IP, Port, VM ID, Container ID, Image ID, Host ID, Data Center Row and Rack location, Data Center Geo-location
• Who2 - UID, GID, Customer ID, Transaction ID, cart ID
• Message - Text Message including incident level
Thinking about moving the services to containers (Thinking not just off the top of my head; the container will create an security risk because of the need for --privileged) or systemd. (systemctl status docker.service ; journalctl -xe )
Full container capabilities (--privileged)
The --privileged flag gives all capabilities to the container, and it also lifts all the limitations enforced by the device cgroup controller. In other words, the container can then do almost everything that the host can do. This flag exists to allow special use-cases, like running Docker within Docker.
change uptime
to
awk '$1~/cpu[0-9]/{usage=($2+$4)*100/($2+$4+$5); print $1": "usage"%"}' /proc/stat
so can see each CPU
scrollphat/display-message.py add test if scrollpHAT available
$ ./display-message.py -h
Traceback (most recent call last):
File "./display-message.py", line 37, in
import scrollphat
File "/usr/lib/python2.7/dist-packages/scrollphat/init.py", line 20, in
controller = IS31FL3730(smbus, font)
File "/usr/lib/python2.7/dist-packages/scrollphat/IS31FL3730.py", line 21, in init
self.set_mode(self.i2cConstants.MODE_5X11)
File "/usr/lib/python2.7/dist-packages/scrollphat/IS31FL3730.py", line 62, in set_mode
self.bus.write_i2c_block_data(self.i2cConstants.I2C_ADDR, self.i2cConstants.CMD_SET_MODE, [self.i2cConstants.MODE_5X11])
IOError: [Errno 5] Input/output error
scrollphat,test,py Change echo or print DEBUG INFO WARNING ERROR
create-message.sh copy all data files to all systems in cluster to support failover
add pi-display/scrollphat/help-message.py debug statement
create-message.sh add support for comment in SYSTEMS file
Then this file can be supported with other scripts like cluster-command.sh
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
caused by these two lines
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
display-message-hd.py Change echo or print DEBUG INFO WARNING ERROR
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.