Skip to content

Instantly share code, notes, and snippets.

@btgoodwin
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save btgoodwin/bf48ba35cc97d8660c29 to your computer and use it in GitHub Desktop.

Select an option

Save btgoodwin/bf48ba35cc97d8660c29 to your computer and use it in GitHub Desktop.
Patch file for supervisord.conf to mirror what happens with the LiveDVD.
--- a/python/FrontEndController.py
+++ b/python/FrontEndController.py
@@ -37,10 +37,10 @@ class FrontEndController_i(FrontEndController_base):
example of FEI Allocations and connections. It was developed with REDHAWK 1.10.0.
"""
- targetComponent=None
+ targetComponents=[]
targetDevice=None
domain = None
- targetComponentPort = None
+ targetComponentPorts = []
targetDevicePort = None
feiTunerPort = None
connected = False
@@ -66,6 +66,8 @@ class FrontEndController_i(FrontEndController_base):
self._log.error("Exception occurred while deallocating and disconnecting.")
finally:
self.connected = False
+ self.targetComponents=[]
+ self.targetComponentPorts=[]
FrontEndController_base.stop(self)
@@ -155,16 +157,29 @@ class FrontEndController_i(FrontEndController_base):
# Gets the component from the application. The component name can be the name or instantition. ex. DataConverter or DataConveter_3
# This allows you to use the same component multiple times in a waveform and know for certain which one you are connecting to.
+ # Support for multiple input components using comma as a separator
+ targetComps = [t.strip() for t in self.InputComponent.componentName.split(',')]
+ targetCompPorts = [t.strip() for t in self.InputComponent.inputPortName.split(',')]
+ if len(targetComps) != len(targetCompPorts):
+ self._log.error("Stopping. The number of InputComponent componentName vs. inputPortName did not match.")
+ self.stop()
+ return
+
+ targets = zip(targetComps, targetCompPorts)
for comp in waveform.comps:
- if self.InputComponent.componentName in comp._instanceName:
- self.targetComponent = comp
- break
+ for target in targets:
+ if target[0] in comp._instanceName:
+ self.targetComponents.append(comp)
+ self.targetComponentPorts.append(comp.getPort(target[1]))
+ if None == self.targetComponentPorts[-1]:
+ self._log.error("Stopping. Could not find the component {0} input port: {1}".format(target[0], target[1]))
+ self.stop()
+ return
- if self.targetComponent is None:
- self._log.error("Stopping. Could not find the component: " + self.InputComponent.componentName)
+ if 0 == len(self.targetComponents):
+ self._log.error("Stopping. Could not find the component(s): " + self.InputComponent.componentName)
self.stop();
return
-
self._log.debug("Searching device managers for device: " + self.FEIDevice.deviceName)
@@ -177,14 +192,8 @@ class FrontEndController_i(FrontEndController_base):
# Gets the references to the input and output ports
- self.targetComponentPort = self.targetComponent.getPort(self.InputComponent.inputPortName)
self.targetDevicePort = self.targetDevice.getPort(self.FEIDevice.outputPortName)
self.feiTunerPort = self.targetDevice.getPort(self.FEIDevice.tunerPortName)
-
- if self.targetComponentPort is None:
- self._log.error("Stopping. Could not find the component input port: " + self.InputComponent.inputPortName)
- self.stop()
- return
if self.targetDevicePort is None:
self._log.error("Stopping. Could not find the component output port: " + self.FEIDevice.outputPortName)
@@ -227,14 +236,14 @@ class FrontEndController_i(FrontEndController_base):
# Makes the actual connection
self._log.debug("Connecting component and device ports")
- self.targetDevicePort.connectPort(self.targetComponentPort, self.allocationId)
+ [self.targetDevicePort.connectPort(p, self.allocationId) for p in self.targetComponentPorts]
self.connected = True
self._log.debug("Starting device and component")
# Make sure device and component are started
self.targetDevice.start()
- self.targetComponent.start()
+ [c.start() for c in self.targetComponents]
# This component does no processing so we can just return FINISH so
# the process method does not get called again.
--- a/default.conf 2014-11-11 11:27:04.000000000 -0500
+++ b/default.conf 2015-01-14 08:22:13.309668662 -0500
@@ -9,11 +9,8 @@
#access_log logs/host.access.log main;
- # Load configuration files for the default server block.
- include /etc/nginx/default.d/*.conf;
-
location / {
- root /usr/share/nginx/html;
+ root /var/redhawk/web/html;
index index.html index.htm;
}
@@ -29,21 +26,7 @@
root /usr/share/nginx/html;
}
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
-
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- #location ~ \.php$ {
- # root html;
- # fastcgi_pass 127.0.0.1:9000;
- # fastcgi_index index.php;
- # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
- # include fastcgi_params;
- #}
+ include /etc/nginx/conf.d/redhawk-sites/*.enabled;
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
--- a/rtl-demo-domain-supervisor.conf 2015-01-09 13:29:18.177592992 -0500
+++ b/rtl-demo-domain-supervisor.conf 2015-01-13 13:02:37.045289695 -0500
@@ -1,13 +1,13 @@
-[program:redhawk-rtl-demo-domain]
-command=/var/redhawk/web/rtl-demo/app/bin/startdomain.sh ; the program (relative uses PATH, can take args)
+[program:redhawk-domain]
+command=/var/redhawk/web/rest-python/startdomain.sh ; the program (relative uses PATH, can take args)
user=redhawk
;priority=999 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
-stdout_logfile=/var/log/redhawk-web/rtl-demo-domain.log ; stdout log path, NONE for none; default AUTO
+stdout_logfile=/var/log/redhawk-web/redhawk-domain.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
-stderr_logfile=/var/log/redhawk-web/rtl-demo-domain-error.log ; stderr log path, NONE for none; default AUTO
+stderr_logfile=/var/log/redhawk-web/redhawk-domain-error.log ; stderr log path, NONE for none; default AUTO
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
--- a/supervisord 2014-10-17 12:36:32.000000000 -0400
+++ b/supervisord 2015-01-09 09:43:02.434360721 -0500
@@ -9,28 +9,29 @@
# description: supervisor is a process control utility. It has a web based
# xmlrpc interface as well as a few other nifty features.
# processname: supervisord
-# config: /etc/supervisord.conf
-# pidfile: /var/run/supervisord.pid
#
# source function library
. /etc/rc.d/init.d/functions
-RETVAL=0
+# Ideas sourced from the LiveDVD, modified to be generic to a cloned repo installation
+prog="supervisord"
+pythonenv="/var/redhawk/web/rest-python/pyvenv"
+prog_bin="${pythonenv} ${prog}"
+opts="-c /etc/redhawk-web/supervisord.conf"
+PIDFILE="/var/redhawk/web/$prog.pid"
start() {
- echo -n $"Starting supervisord: "
- daemon supervisord
- RETVAL=$?
+ echo -n $"Starting $prog: "
+ daemon $prog_bin --pidfile $PIDFILE $opts
+ [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"
echo
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
}
stop() {
echo -n $"Stopping supervisord: "
- killproc supervisord
+ [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown"
echo
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/supervisord
}
restart() {
@@ -45,19 +46,19 @@
stop)
stop
;;
- restart|force-reload|reload)
+ status)
+ status $prog
+ ;;
+ restart)
restart
;;
- condrestart)
- [ -f /var/lock/subsys/supervisord ] && restart
+ control)
+ ${pythonenv} supervisorctl -s unix:///tmp/redhawk-supervisor.sock
;;
- status)
- status supervisord
- RETVAL=$?
+ list)
+ ${pythonenv} supervisorctl -s unix:///tmp/redhawk-supervisor.sock status
;;
*)
- echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
+ echo $"Usage: $0 {start|stop|status|restart|control|list}"
exit 1
esac
-
-exit $RETVAL
--- a/RTL_FM_Waveform.sad.xml
+++ b/RTL_FM_Waveform.sad.xml
@@ -8,9 +8,6 @@
<componentfile id="AmFmPmBasebandDemod_ab1df5d3-aa1c-4590-b9cc-49ea1394e0ff" type="SPD">
<localfile name="/components/AmFmPmBasebandDemod/AmFmPmBasebandDemod.spd.xml"/>
</componentfile>
- <componentfile id="NOOP_8fada4c5-e51a-4dcb-acb3-6db8a3323891" type="SPD">
- <localfile name="/components/NOOP/NOOP.spd.xml"/>
- </componentfile>
<componentfile id="psd_b0381234-3314-4b84-b2b7-35a209092797" type="SPD">
<localfile name="/components/psd/psd.spd.xml"/>
</componentfile>
@@ -54,15 +51,6 @@
</componentinstantiation>
</componentplacement>
<componentplacement>
- <componentfileref refid="NOOP_8fada4c5-e51a-4dcb-acb3-6db8a3323891"/>
- <componentinstantiation id="NOOP_1" startorder="10">
- <usagename>NOOP_1</usagename>
- <findcomponent>
- <namingservice name="NOOP_1"/>
- </findcomponent>
- </componentinstantiation>
- </componentplacement>
- <componentplacement>
<componentfileref refid="psd_b0381234-3314-4b84-b2b7-35a209092797"/>
<componentinstantiation id="wideband_psd" startorder="12">
<usagename>wideband_psd</usagename>
@@ -141,7 +129,7 @@
<simpleref refid="outputPortName" value="dataFloat_out"/>
</structref>
<structref refid="InputComponent">
- <simpleref refid="componentName" value="NOOP"/>
+ <simpleref refid="componentName" value="TuneFilterDecimate, wideband_psd"/>
<simpleref refid="inputPortName" value="dataFloat_In, dataFloat_in"/>
</structref>
<structref refid="TuneRequest">
@@ -159,26 +147,6 @@
<componentinstantiationref refid="FrontEndController_1"/>
</assemblycontroller>
<connections>
- <connectinterface id="connection_1">
- <usesport>
- <usesidentifier>dataFloat_out</usesidentifier>
- <componentinstantiationref refid="NOOP_1"/>
- </usesport>
- <providesport>
- <providesidentifier>dataFloat_In</providesidentifier>
- <componentinstantiationref refid="TuneFilterDecimate_1"/>
- </providesport>
- </connectinterface>
- <connectinterface id="connection_6">
- <usesport>
- <usesidentifier>dataFloat_out</usesidentifier>
- <componentinstantiationref refid="NOOP_1"/>
- </usesport>
- <providesport>
- <providesidentifier>dataFloat_in</providesidentifier>
- <componentinstantiationref refid="wideband_psd"/>
- </providesport>
- </connectinterface>
<connectinterface id="connection_2">
<usesport>
<usesidentifier>dataFloat_Out</usesidentifier>
--- a/startdomain.sh 2015-01-09 13:29:18.176592986 -0500
+++ b/startdomain.sh 2015-01-14 11:56:32.532517607 -0500
@@ -20,14 +20,8 @@
#
RHDOMAIN=REDHAWK_DEV
-
-DIGITIZER_NODE=/nodes/RTL2832_Node/DeviceManager.dcd.xml
-
-GPP_NODE_NAME=RTL-Demo-GPP-Node
+GPP_NODE_NAME="DevMgr_redhawk-vm.geontech.local"
GPP_NODE=/nodes/${GPP_NODE_NAME}/DeviceManager.dcd.xml
-
-FEIDEVICE=RTL2832U
-startmsg='with RTL frontend node'
QUOTES=\'\"
DQUOTE=\"
@@ -36,9 +30,7 @@
Usage: $0 [-sh]
-d DOMAIN
- -r SDRROOT
-h Show help
- -s Run with the RTL simulator
EOFEOF
}
@@ -64,13 +56,7 @@
while getopts "hsd:r:" opt ; do
case "$opt" in
- s) DIGITIZER_NODE=/nodes/sim_RX_DIGITIZER_Node/DeviceManager.dcd.xml
- FEIDEVICE=sim_RX_DIGITIZER
- startmsg='with RTL simulator node' ;;
d) RHDOMAIN="$OPTARG" ;;
- r) export SDRROOT="$OPTARG"
- # make absolute
- export SDRROOT=`cd "$SDRROOT" && pwd` ;;
h) usage; exit 0 ;;
*) err "BAD PARAMETER $opt" ;;
esac
@@ -91,16 +77,6 @@
# kill all remaining subprocesses at exit
trap 'killif $pids' 0 1 2 15
-if [ ! -f "$SDRROOT/dev/$GPP_NODE" ]; then
- ${SDRROOT}/dev/devices/GPP/python/nodeconfig.py --domainname=${RHDOMAIN} --nodename=${GPP_NODE_NAME} --inplace
-fi
-
-# FIXME: Should be waveform init properties from the rtl app
-# modify the domain name and Front end device in waveform
-sed -i "/refid=.DomainName/ s/value=[$QUOTES][^$QUOTES]*[$QUOTES]/value=${DQUOTE}${RHDOMAIN}${DQUOTE}/
- /refid=.FEIDeviceName/ s/value=[$QUOTES][^$QUOTES]*[$QUOTES]/value=${DQUOTE}${FEIDEVICE}${DQUOTE}/" \
- "$SDRROOT/dom/waveforms/RTL_FM_Waveform/RTL_FM_Waveform.sad.xml" || err
-
#NBARGS=--force-rebind --nopersist
NBARGS=--nopersist
@@ -112,11 +88,7 @@
nodeBooter $NBARGS -d "${GPP_NODE}" --domainname $RHDOMAIN > "$LOGDIR"/gpp.log 2>&1 || err &
pids="$pids $!"
-# Digitizer
-nodeBooter $NBARGS -d "$DIGITIZER_NODE" --domainname $RHDOMAIN > "$LOGDIR"/digitizer.log 2>&1 || err &
-pids="$pids $!"
-
-echo "Started $RHDOMAIN domain $startmsg. Use Ctrl-C to halt"
+echo "Started $RHDOMAIN domain. Use Ctrl-C to halt"
# block until all subprocesses are killed.
anywait $pids
--- a/supervisord.conf 2014-10-17 12:36:32.000000000 -0400
+++ b/supervisord.conf 2015-01-09 09:07:59.471725832 -0500
@@ -1,15 +1,20 @@
+; Modified per the LiveDVD suggested setup.
+[unix_http_server]
+file=/tmp/redhawk-supervisor.sock
+chmod=0770
+chown=redhawk:redhawk
[supervisord]
-http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
+;http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
;http_port=127.0.0.1:9001 ; (alternately, ip_address:port specifies AF_INET)
;sockchmod=0700 ; AF_UNIX socketmode (AF_INET ignore, default 0700)
;sockchown=nobody.nogroup ; AF_UNIX socket uid.gid owner (AF_INET ignores)
;umask=022 ; (process file creation umask;default 022)
-logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
+logfile=/var/log/redhawk-web/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (logging level;default info; others: debug,warn)
-pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
+pidfile=/var/redhawk/web/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
@@ -18,12 +23,15 @@
;http_username=user ; (default is no username (open system))
;http_password=123 ; (default is no password (open system))
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
-;user=chrism ; (default is current user, required if root)
+user=redhawk ; (default is current user, required if root)
;directory=/tmp ; (default is not to cd during start)
;environment=KEY=value ; (key value pairs to add to environment)
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
[supervisorctl]
-serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket
+serverurl=unix:///tmp/redhawk-supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set
@@ -50,4 +58,6 @@
;logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;logfile_backups=10 ; # of logfile backups (default 10)
-
+; This includes all configuration files in supervisor.d which are for each service to manage
+[include]
+files = supervisor.d/*.conf
@btgoodwin

Copy link
Copy Markdown
Author

See associated guide for how to apply patches to add the rest-python and admin-console functionality to your REDHAWK system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment