# TODO: need to sort on 'round' since actions will not be globally sync'd.
return cls.query.filter_by(**kwargs).order_by(ActionRecord.id.desc()).first()
+ @classmethod
+ def delete_recent_by(cls, since, **kwargs):
+ acts = cls.query.filter_by(**kwargs).filter(cls.date_created >= datetime.now() - timedelta(since)).order_by(cls.date_created.desc())
+ for i in acts: i.delete()
+
# ACCOUNTING
date_created = Field(DateTime,default=datetime.now)
loginbase = Field(String,default=None)
echo ' "nm_status":"'`ps ax | grep nm.py | grep -v grep`'",'
echo ' "dns_status":"'`host boot.planet-lab.org 2>&1`'",'
echo ' "princeton_comon_dir":"'`ls -d /vservers/princeton_comon`'",'
+ echo ' "uptime":"'`uptime`'",'
ID=`grep princeton_comon /etc/passwd | awk -F : '{if ( $3 > 500 ) { print $3}}'`
echo ' "princeton_comon_running":"'`ls -d /proc/virtual/$ID`'",'
values.update({'kernel_version': "", 'bmlog' : "", 'bootcd_version' : '',
'nm_status' : '',
'fs_status' : '',
+ 'uptime' : '',
'dns_status' : '',
'rpm_version' : '',
'rpm_versions' : '',
print "ALLVERSIONS: %s %s" % (nodename, values['rpm_versions'])
print "RPMVERSION: %s %s" % (nodename, values['rpm_version'])
+ print "UPTIME: %s %s" % (nodename, values['uptime'])
### RUN SSH ######################
b_getbootcd_id = True
'memsize' : 'null'}
# include output value
### GET PLC NODE ######################
- plc_lock.acquire()
- d_node = None
- try:
- d_node = plccache.GetNodeByName(nodename)
- #d_node = plc.getNodes({'hostname': nodename}, ['pcu_ids', 'site_id',
- # 'date_created', 'last_updated',
- # 'last_contact', 'boot_state', 'nodegroup_ids'])[0]
- except:
- traceback.print_exc()
- plc_lock.release()
+ d_node = plccache.GetNodeByName(nodename)
values['plc_node_stats'] = d_node
##### NMAP ###################