Branch 'devel' - caslib/cas.py caslib/__init__.py
by Adam Stokes
caslib/__init__.py | 1 +
caslib/cas.py | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 3db5e718cd232f9af8dfc4782583448f5a565a7f
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 12 15:32:24 2010 -0400
Fixed sql to perform like matches against timestamp
diff --git a/caslib/__init__.py b/caslib/__init__.py
index cbccc55..8e9cc9d 100644
--- a/caslib/__init__.py
+++ b/caslib/__init__.py
@@ -40,4 +40,5 @@ info_messages = {
2 : "Starting job",
3 : "Processing corefile",
4 : "Job complete",
+ 5 : "Matched timestamp",
}
diff --git a/caslib/cas.py b/caslib/cas.py
index f245b0d..4b9470c 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -93,7 +93,7 @@ def timestampHandler(corefile):
# query timestamp table, return tuple debuginfoRPM, and path to
# debugKernel
sess = Session()
- timestamp_query = sess.query(Timestamp).filter_by(stampKey=timestamp).first()
+ timestamp_query = sess.query(Timestamp).filter(Timestamp.stampKey.like('%'+timestamp+'%')).first()
sess.close()
if timestamp_query:
return (timestamp_query)
@@ -186,9 +186,9 @@ class CasApplication(object):
corefile = coreHandler(self.filename)
self.jobRecord.msg = _i[3] + ": %s" % (corefile,)
timestamp = timestampHandler(corefile)
+ self.jobRecord.msg = _i[5]
+ self.sess.commit()
if type(timestamp) == str:
- self.jobRecord.msg = timestamp
- self.sess.commit()
return False
corefileArch = self.util.getElfArch(corefile)
14 years
Branch 'devel' - cas-admin caslib/cas.py caslib/core.py overseer/command.py overseer/static
by Adam Stokes
cas-admin | 10 ++--
caslib/cas.py | 101 ++++++++++++----------------------------------
caslib/core.py | 11 +----
overseer/command.py | 9 +++-
overseer/static/list.html | 2
5 files changed, 45 insertions(+), 88 deletions(-)
New commits:
commit fb6240e33daf549d63ce31194984008fe0bc388f
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 12 14:44:51 2010 -0400
refine cas backend
diff --git a/cas-admin b/cas-admin
index deba1c3..35abdc4 100755
--- a/cas-admin
+++ b/cas-admin
@@ -24,7 +24,6 @@ if sys.version_info[:2] < (2,4):
try:
from caslib.db import *
# Setup session for db interaction
- session = Session()
except:
raise SystemExit('Can not interface with database, please check configuration settings' \
'and try again')
@@ -66,7 +65,7 @@ if config.has_option("advanced", "buffersize"):
util = Utility()
-def queryLocalRpms(path):
+def queryLocalRpms():
""" query debug kernels located on the filesystem
Arguments:
@@ -78,9 +77,11 @@ def queryLocalRpms(path):
results, err = casexecute(cmd, True)
dst = tempfile.mkdtemp(prefix='cas-')
for rpm in results.split():
+ session = Session()
rpm_IN_DB = session.query(RPM).filter_by(rpmPath=rpm).first()
if not rpm_IN_DB:
# add RPM to database
+ session = Session()
rpm_record = RPM(rpm)
session.add(rpm_record)
session.commit()
@@ -97,8 +98,9 @@ def queryLocalRpms(path):
debugKernel,
rpm_record.rpmId)
session.add(timestamp_record)
- # commit to database
- session.commit()
+ # commit to database
+ session.commit()
+ session.close()
# Cleanup extracted debugs
shutil.rmtree(dst)
genprint("CAS Database generation complete.")
diff --git a/caslib/cas.py b/caslib/cas.py
index 10bc41d..f245b0d 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -35,6 +35,8 @@ import socket
import paramiko
import hashlib
from urlgrabber import grabber
+from subprocess import Popen, PIPE, call
+import shutil
from datetime import datetime
@@ -45,16 +47,6 @@ from caslib.rpmutils import extractDebug
from caslib import error_messages as _e
from caslib import info_messages as _i
-if sys.version_info[:2] < (2,6):
- from caslib.cas_subprocess import Popen, PIPE, call
- import caslib.cas_shutil as shutil
-else:
- from subprocess import Popen, PIPE, call
- import shutil
-
-if sys.version_info[:2] < (2,4):
- raise SystemExit("Python >= 2.4 required")
-
# Configuration parsing of /etc/cas.conf
# TODO: rework config read to place all items
# into a key,value pair automatically
@@ -78,40 +70,31 @@ BUFFERSIZE=None
if config.has_option("advanced", "buffersize"):
BUFFERSIZE=config.get("advanced", "buffersize")
-def coreHandler(uri, dst):
- dst = os.path.join(dst, os.path.basename(uri))
+def coreHandler(uri):
try:
- grabber.urlgrab(uri)
+ downloadLocation = grabber.urlgrab(uri, filename=os.path.basename(uri), copy_local=1)
except grabber.URLGrabError, e:
- genprint(e)
- shutil.move(uri, dst)
- if not coreIsCorefile(dst):
- os.chdir(os.path.dirname(dst))
- genprint("Detected a compressed core, extracting.." \
- "please wait as this process can take a " \
- "long time.")
- corepath = coreExtract(dst)
+ return e
+ if not coreIsCorefile(downloadLocation):
+ corepath = coreExtract(downloadLocation)
if not corepath:
- raise SystemExit(_e[3])
+ return False
else:
return corepath
else:
- return dst
- # corefile extracted now move it to work directory, pull basename
- # from corepath since we auto-detect the core file from extraction
- coreBasename = os.path.basename(corepath)
- filename = os.path.join(dst, coreBasename)
- return filename
+ return downloadLocation
def timestampHandler(corefile):
# dig through the buildstamp database and attempt to match it with
# the one found in the core
timestamp = coreTimestamp(corefile, BUFFERSIZE)
if not coreTimestamp:
- raise SystemExit(genprint(err))
+ raise SystemExit(err)
# query timestamp table, return tuple debuginfoRPM, and path to
# debugKernel
- timestamp_query = session.query(Timestamp).filter_by(stampKey=timestamp).first()
+ sess = Session()
+ timestamp_query = sess.query(Timestamp).filter_by(stampKey=timestamp).first()
+ sess.close()
if timestamp_query:
return (timestamp_query)
return _e[2]
@@ -149,11 +132,7 @@ class CasApplication(object):
if not self.opts.filename:
parser.error("A file object is missing.")
else:
- if os.path.isfile(self.opts.filename):
- self.filename = self.opts.filename
- else:
- raise SystemExit(genprint("%s : %s" % (_e[7],
- self.opts.filename)))
+ self.filename = self.opts.filename
# check if we want to strip the core
if self.opts.strip_core:
@@ -161,7 +140,6 @@ class CasApplication(object):
# check helper function first
if self.opts.compress_core:
- genprint('Compressing: %s ... please wait' % (filename,))
out, err = coreCompress(os.path.abspath(self.opts.filename))
if err:
return _e[8]
@@ -200,44 +178,39 @@ class CasApplication(object):
self.sess.commit()
if not os.path.isdir(self.storagePath):
os.makedirs(self.storagePath)
+ # Change to newly created directory to perform all tasks
+ os.chdir(self.storagePath)
self.jobRecord.msg = _i[2] + " : %s" % (self.storagePath,)
self.sess.commit()
- genprint("Starting job at %s" % (self.storagePath,))
# begin core extraction analysis
- corefile = coreHandler(self.filename, self.storagePath)
+ corefile = coreHandler(self.filename)
self.jobRecord.msg = _i[3] + ": %s" % (corefile,)
- genprint("Corefile prepared, processing %s" % (corefile,))
timestamp = timestampHandler(corefile)
- # we've got corefile prepped, timestamp, and debugkernel identified
- # chdir into work directory and proceed
- os.chdir(self.storagePath)
+ if type(timestamp) == str:
+ self.jobRecord.msg = timestamp
+ self.sess.commit()
+ return False
corefileArch = self.util.getElfArch(corefile)
- # genprint("core arch %s" % (corefileArch,))
-
# Read current machine arch to see if we can bypass remote machine
# processing
currentMachineArch = Popen(["uname","-m"], stdout=PIPE, stderr=PIPE)
currentMachineArch = currentMachineArch.stdout.read().strip()
- genprint("local machine arch %s" % (currentMachineArch,))
# check if an installed vmlinux can be used (symlink to save space)
local_vmlinux = "/%s" % (timestamp.debugPath,)
if currentMachineArch == corefileArch and \
os.path.isfile(local_vmlinux):
- # genprint("Using local debug kernel")
os.symlink(local_vmlinux, "%s/%s" %
(self.storagePath, "vmlinux"))
# define absolute path to debugkernel
debugKernel = os.path.abspath("vmlinux")
else:
filterString = "*/%s" % (timestamp.debugPath,)
- # genprint("Extracting debug kernel with filter %s" % (filterString,))
extractDebug(timestamp.rpmPath, self.storagePath,
filter=filterString,
return_results=False)
- genprint("checking debug kernel %s" % (timestamp.debugPath,))
# setup crash file to finalize the processing of the core file
self.util.buildCrashFile(self.storagePath, corefile, debugKernel)
@@ -253,8 +226,6 @@ class CasApplication(object):
self.util.buildCrashFile(self.storagePath, corefile,
timestamp.debugPath,
crash_bin=CRASH_32)
- genprint("Current machine suitable for processing 32 bit core, "\
- "running crash.")
cmd = "./crash -i crash.in > crash.out"
cmdPipe = Popen([cmd], stdout=PIPE, stderr=PIPE, shell=True)
cmdData = cmdPipe.communicate()
@@ -262,14 +233,12 @@ class CasApplication(object):
sts, out, err = (cmdPipe.returncode, cmdData[0].strip(),
cmdData[1].strip())
if sts:
- genprint("crash problem: err: %s, out: %s" % (err, out))
+ return (out, err)
elif debugKernelArch == currentMachineArch:
import platform
# Define current machine hostname, mainly used for email results.
casProcessMachine = platform.uname()[1]
# The machine is suitable for processing the core through crash.
- genprint("Current machine suitable for processing core, " \
- "running crash.")
cmd = "./crash -i crash.in > crash.out"
cmdPipe = Popen([cmd], stdout=PIPE, stderr=PIPE, shell=True)
cmdData = cmdPipe.communicate()
@@ -279,14 +248,11 @@ class CasApplication(object):
if sts:
self.jobRecord.msg = err
self.sess.commit()
- genprint("crash problem: err: %s, out: %s" % (err, out))
else:
# The machine running cas isn't capable of processing this core, lets
# attempt with paramiko. Assuming paramiko is installed and a server database
# is configured we attempt to process the core at another machine.
try:
- genprint("Crash file built, locating suitable %s system for " \
- "processing" % (debugKernelArch,))
serverList = self.db.getServers()
ssh_obj = paramiko.SSHClient()
ssh_obj.load_host_keys(os.path.expanduser("~/.ssh/known_hosts"))
@@ -294,8 +260,6 @@ class CasApplication(object):
for hostname, arch, port in serverList:
if arch == debugKernelArch:
# TODO: Randomize server selection
- genprint("Machine %s found, processing " \
- "crash output" % (hostname,))
cmd = ["cd " + os.path.join(self.storagePath) + "\n",
"./crash -i crash.in > crash.out\n"]
Executor(settings["SSHKEY"], hostname,
@@ -303,22 +267,15 @@ class CasApplication(object):
cmd).run()
break
else:
- genprint("No servers available for arch and current system not "\
- "suitable for processing, please run cas-admin -h " \
- "for more information")
+ return False
else:
self.jobRecord.msg = _e[80]
self.sess.commit()
return _e[80]
except ImportError:
- genprint("Current running machine is not suitable for processing this core " \
- "and python-paramiko is not installed/configured properly.")
- genprint("Finishing job without processing the core, please find a suitable %s "\
- "machine in order to view this core in crash." % (debugKernelArch,))
+ return False
crashOutFile = os.path.join(self.storagePath,"modules")
if os.path.isfile(crashOutFile) and self.extractKernelModules:
- genprint("Extracting loaded kernels modules. This will " \
- "take several minutes.")
# Here we extract kernel modules processed from crash.out
# this is usually desired during filesystem, storage
# analysis of a core.
@@ -349,8 +306,6 @@ class CasApplication(object):
if os.path.isfile(crashOutFile) and \
self.email and \
settings["NOTIFY"]:
- genprint("Crash output processed, sending email to %s" % \
- (self.email,))
try:
mailServer = smtplib.SMTP(settings["SMTPHOST"])
try:
@@ -368,16 +323,14 @@ class CasApplication(object):
finally:
mailServer.quit()
except smtplib.SMTPException, e:
- genprint("Unable to connect to mail server: %s (%s), " \
- "no email results sent." % (SMTPHOST,str(e)))
+ self.jobRecord.msg = e
+ self.sess.commit()
except (os.error, socket.error), e:
self.jobRecord.msg = e
self.sess.commit()
- genprint(e)
+ return False
self.jobRecord.msg = _i[4]
self.sess.commit()
- genprint("Job on %s complete and located in %s." % (self.filename,
- self.storagePath))
# cleanup job
self.sess.close()
return
diff --git a/caslib/core.py b/caslib/core.py
index 1a3c1c6..4ab02ee 100644
--- a/caslib/core.py
+++ b/caslib/core.py
@@ -77,13 +77,10 @@ def coreFormat(data, fname):
return suffix_map["bz2"]
return False
-def coreExtract(self, filepath):
+def coreExtract(filepath):
""" utility to extract archive and pull out core
"""
- # Making an assumption that if we are extracting a file then
- # the contents of that file are placed wherever cas is run from
- dst = os.path.realpath(os.curdir)
- filepath = filepath
+ dst = os.path.dirname(filepath)
fd = open(filepath, 'rb')
data = os.read(fd.fileno(), 1000)
format = coreFormat(data, filepath)
@@ -91,9 +88,6 @@ def coreExtract(self, filepath):
return _e[5]
else:
format.append(filepath)
- # FIXME: failing to determine corefile after extraction, running
- # on extracted core works. possible problem being looking in the wrong
- # directory
p = Popen(format, stdout=PIPE, stderr=PIPE)
err = p.stderr.read()
out = p.stdout.read()
@@ -130,6 +124,7 @@ def coreTimestamp(path, blksize=None):
blksize = 540000000
b = os.read(fd.fileno(),blksize)
out = util.regexSearch(match, b)
+ fd.close()
if out:
return out
return _e[4]
diff --git a/overseer/command.py b/overseer/command.py
index 6e2b364..5f5f364 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -18,6 +18,10 @@
import sys
sys.path.append("/usr/share/cas")
+
+if sys.version_info[:2] < (2,6):
+ raise SystemExit("Python >= 2.6 required")
+
import os
import cherrypy
import simplejson as json
@@ -25,6 +29,7 @@ from caslib.db import *
from mako.template import Template
from mako.lookup import TemplateLookup
import subprocess
+from multiprocessing import Process
current_dir = os.path.dirname(os.path.abspath(__file__))
mylookup = TemplateLookup(directories=[current_dir + '/static'])
@@ -60,7 +65,9 @@ class Root:
record.jobId)
# push cmd into background and let the cas application handle
# any errors
- run(cmd)
+ p = Process(target=run, args=(cmd,))
+ p.start()
+ p.join()
mytemplate = mylookup.get_template("create.html")
return mytemplate.render(record=record)
else:
diff --git a/overseer/static/list.html b/overseer/static/list.html
index 6649279..de8f2b5 100644
--- a/overseer/static/list.html
+++ b/overseer/static/list.html
@@ -2,5 +2,5 @@
<h1>Job List</h1>
<hr />
%for job in job_query:
- ${job.jobId} :: ${job.vmcore}<br />
+ <a href="/status/?id=${job.jobId}">${job.jobId} :: ${job.vmcore}</a><br />
%endfor
14 years
Branch 'devel' - cas.spec
by Adam Stokes
cas.spec | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit b2650214bf16bfe6f6b4801090a9cd83cf764cb6
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 12 11:33:31 2010 -0400
add proper mako require
diff --git a/cas.spec b/cas.spec
index 77a4fd6..7deb8b0 100644
--- a/cas.spec
+++ b/cas.spec
@@ -21,8 +21,7 @@ Requires: python-cherrypy
Requires: python-simplejson
Requires: python-urlgrabber
Requires: python-sqlalchemy
-Requires: python-genshi
-Requires: python-formencode
+Requires: python-mako
%description
CAS provides a user the ability to configure an environment for core analysis
@@ -83,7 +82,7 @@ rm -rf ${RPM_BUILD_ROOT}
%{_bindir}/cas-server
%changelog
-* Tue May 4 2010 Adam Stokes <ajs at redhat dot com> - 1.0
+* Tue May 12 2010 Adam Stokes <ajs at redhat dot com> - 1.0
- Create 1.0 release
* Mon May 3 2010 Adam Stokes <ajs at redhat dot com> - 0.18
14 years
Branch 'devel' - 24 commits - overseer/command.py
by Adam Stokes
overseer/command.py | 1 -
1 file changed, 1 deletion(-)
New commits:
commit d1c773d8b94b9a35cfb9e6d3807d39d904f7f119
Merge: 50e3862... 615bd85...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 12 11:31:44 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
Conflicts:
overseer/command.py
diff --cc overseer/command.py
index af99284,6103441..6e2b364
--- a/overseer/command.py
+++ b/overseer/command.py
@@@ -27,27 -37,63 +37,62 @@@ class Root
@cherrypy.expose
def index(self):
""" Ability to create/query jobs """
- return
+ session = Session()
+ mytemplate = mylookup.get_template("index.html")
+ latest_query = session.query(Job).order_by(Job.jobId.desc())[0:10]
+ session.close()
+ return mytemplate.render(recent=latest_query)
@cherrypy.expose
- def create(self, identifier, email, vmcore):
+ def create(self, **data):
""" Create job """
- job_record = Job(identifier, email, vmcore)
- session.add(job_record)
- session.commit()
- return json.encode(job_record)
+ session = Session()
+ if not session.query(Job).filter_by(identifier=data['identifier']).first():
+ jobRecord = Job(data['identifier'],
+ data['email'],
+ data['vmcore'])
+ session.add(jobRecord)
+ session.commit()
+ record = jobRecord
+ cmd = "cas -i %s -f %s -e %s --job %s" % (record.identifier,
+ record.vmcore,
+ record.email,
+ record.jobId)
+ # push cmd into background and let the cas application handle
+ # any errors
+ run(cmd)
+ mytemplate = mylookup.get_template("create.html")
+ return mytemplate.render(record=record)
+ else:
+ raise cherrypy.HTTPRedirect('/')
+
+ @cherrypy.expose
+ def status(self, **data):
+ """ Return job stats """
+ session = Session()
+ status_query = session.query(Job).filter_by(jobId=data['id']).first()
+ mytemplate = mylookup.get_template("status.html")
+ session.close()
+
+ if status_query:
+ return mytemplate.render(status=status_query)
+ else:
+ return mytemplate.render(errors={'error' : 'Job Not Found'})
@cherrypy.expose
- def status(self, id):
- """ Return job status """
- test = {'name':'adam', data:'4-26-10' }
- return json.dumps(test)
+ def list(self):
+ """ list all jobs """
+ session = Session()
+ job_query = session.query(Job).order_by(Job.jobId.desc()).all()
+ session.close()
+ mytemplate = mylookup.get_template("list.html")
+ return mytemplate.render(job_query=job_query)
-
def main():
- root = Delegate()
- root.admin = Admin()
- cherrypy.server.socket_port = 8112
- cherrypy.quickstart(root)
+ root = Root()
+ cherrypy.config.update(current_dir + "/site.conf")
+ cherrypy.tree.mount(root, '/', current_dir + "/site.conf")
+ cherrypy.engine.start()
if __name__=="__main__":
main()
commit 50e38627625ce18966fddd3f7d0fbe5e7f4215e8
Merge: 3855541... 6c0e4d3...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 5 13:27:24 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 38555412857c256fad5f567345ffcc8bebd4a3a8
Merge: f435d59... 7c4a10a...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 5 11:47:24 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit f435d59d2ea3f4fa7835c58becd43cf1b5af75a5
Merge: b0b1d0d... e4111a0...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 20:01:03 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit b0b1d0df10fef3a5862d336f0069923e27f4d702
Merge: 0e2d090... 5613947...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:46:41 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 0e2d090587b906d380bba4706a8a5cb0c3e846ca
Merge: cbc6b41... c690762...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:44:42 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit cbc6b412b2d274cb01604fa322cc7ca0b3d48a87
Merge: 20d6990... def6e91...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:28:52 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 20d6990b219f60a5ec89371cca69b74ae0bcc8a3
Merge: e4ea97c... e3ee088...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:27:49 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit e4ea97cfb1b77ff0302927156266d724d95780f4
Merge: 6834d9d... ecf556a...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:03:22 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 6834d9d17cdf8140e74ddabc6cf6db32b7ebf496
Merge: 1d91492... 5e5e658...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 14:53:39 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 1d91492873064ee4ea0e7007019345b8c2de654e
Merge: b2a85da... 5561b5c...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 14:34:56 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit b2a85da97f1965200913c3abb5ffef89f10c5c13
Merge: 9a18804... 2e4fafe...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 14:31:48 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 9a18804e9d74802d7e72486ee554cde5db86fb50
Merge: 44485e2... a669169...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 13:16:09 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 44485e2b724f067f0d7f735fa1e64c37b3f6ebd4
Merge: 0d5a67c... b9308d1...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 13:14:46 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 0d5a67c5b729dc270affe3d48879570dad035521
Merge: 24d01e7... 2b4cd55...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 13:13:27 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 24d01e76770ca81dee7a12540a1c4f9152159cc1
Merge: df55a8d... c9bafde...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 20:49:42 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
diff --cc overseer/command.py
index 90ebf62,9f9d454..544e3e0
mode 100644,100755..100755
--- a/overseer/command.py
+++ b/overseer/command.py
commit df55a8db32b24ec6e805088c4abb894819a7b40b
Merge: 4da1b13... 2c60d21...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:48:22 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 4da1b13e47b1ef573959408f547c61f45660955c
Merge: c8419c8... a1421fe...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:35:31 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit c8419c84d472c41fdcbc8d1751d8a5889f4793c1
Merge: e06bac9... dffbf5e...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:34:28 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit e06bac919576a889511799b9535229fc8b0280dd
Merge: 2afff51... 5e65e2b...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:32:07 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 2afff517e11b2dfa1130756486fe61dab49c39bb
Merge: 54c6d21... 1542eef...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:30:41 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 54c6d21f2961fe8b97be43918451b0df96071d56
Merge: 7df42c6... a1df77c...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:28:32 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 7df42c6a60e01c2ec5a90519aa9b2398c2c2e234
Merge: 9bcc8a2... 17a1681...
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:27:13 2010 -0400
Merge branch 'devel' of ssh://git.fedorahosted.org/git/cas into devel
commit 9bcc8a2f4899adc076eddc84e0f6e20036c2db98
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Mon May 3 19:27:02 2010 -0400
blah
diff --git a/overseer/command.py b/overseer/command.py
index 8d75b23..90ebf62 100644
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -14,7 +14,7 @@
import cherrypy
import simplejson as json
import ConfigParser
-import datetime
+from datetime import datetime
import urlgrabber.grabber as grabber
from caslib.db import CasStorage
@@ -48,7 +48,8 @@ class Delegate:
@cherrypy.expose
def status(self, id):
""" Return job status """
- pass
+ test = {'name':'adam', data:'4-26-10' }
+ return json.dumps(test)
def main():
root = Delegate()
14 years
Branch 'devel' - caslib/cas.py caslib/__init__.py overseer/command.py overseer/static
by Adam Stokes
caslib/__init__.py | 7 +++++++
caslib/cas.py | 27 ++++++++++++++++++++++-----
overseer/command.py | 12 ++++++++++++
overseer/static/base.html | 1 +
overseer/static/index.html | 4 ----
5 files changed, 42 insertions(+), 9 deletions(-)
New commits:
commit 615bd8502f2eeb0a42ea9ad7bc3d3c877c0b6463
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 12 11:29:46 2010 -0400
fork process
diff --git a/caslib/__init__.py b/caslib/__init__.py
index c6691c9..cbccc55 100644
--- a/caslib/__init__.py
+++ b/caslib/__init__.py
@@ -34,3 +34,10 @@ error_messages = {
100 : "This needs root access to run.",
}
+
+info_messages = {
+ 1 : "Building directory structure",
+ 2 : "Starting job",
+ 3 : "Processing corefile",
+ 4 : "Job complete",
+}
diff --git a/caslib/cas.py b/caslib/cas.py
index b703e66..10bc41d 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -43,6 +43,7 @@ from caslib.core import coreTimestamp, coreExtract, coreIsCorefile, coreStrip
from caslib.util import Utility, genprint
from caslib.rpmutils import extractDebug
from caslib import error_messages as _e
+from caslib import info_messages as _i
if sys.version_info[:2] < (2,6):
from caslib.cas_subprocess import Popen, PIPE, call
@@ -183,6 +184,10 @@ class CasApplication(object):
if not self.opts.job:
parser.error("Job ID missing")
+ else:
+ # Pull job data from db
+ self.sess = Session()
+ self.jobRecord = self.sess.query(Job).filter_by(jobId=self.opts.job).first()
self.extractKernelModules = self.opts.kernel_modules
self.storagePath = os.path.join(settings["WORKDIRECTORY"],
@@ -191,11 +196,16 @@ class CasApplication(object):
def run(self):
# setup directory structure
+ self.jobRecord.msg = _i[1]
+ self.sess.commit()
if not os.path.isdir(self.storagePath):
os.makedirs(self.storagePath)
+ self.jobRecord.msg = _i[2] + " : %s" % (self.storagePath,)
+ self.sess.commit()
genprint("Starting job at %s" % (self.storagePath,))
# begin core extraction analysis
corefile = coreHandler(self.filename, self.storagePath)
+ self.jobRecord.msg = _i[3] + ": %s" % (corefile,)
genprint("Corefile prepared, processing %s" % (corefile,))
timestamp = timestampHandler(corefile)
# we've got corefile prepped, timestamp, and debugkernel identified
@@ -203,7 +213,7 @@ class CasApplication(object):
os.chdir(self.storagePath)
corefileArch = self.util.getElfArch(corefile)
- genprint("core arch %s" % (corefileArch,))
+ # genprint("core arch %s" % (corefileArch,))
# Read current machine arch to see if we can bypass remote machine
# processing
@@ -215,14 +225,14 @@ class CasApplication(object):
local_vmlinux = "/%s" % (timestamp.debugPath,)
if currentMachineArch == corefileArch and \
os.path.isfile(local_vmlinux):
- genprint("Using local debug kernel")
+ # genprint("Using local debug kernel")
os.symlink(local_vmlinux, "%s/%s" %
(self.storagePath, "vmlinux"))
# define absolute path to debugkernel
debugKernel = os.path.abspath("vmlinux")
else:
filterString = "*/%s" % (timestamp.debugPath,)
- genprint("Extracting debug kernel with filter %s" % (filterString,))
+ # genprint("Extracting debug kernel with filter %s" % (filterString,))
extractDebug(timestamp.rpmPath, self.storagePath,
filter=filterString,
return_results=False)
@@ -267,6 +277,8 @@ class CasApplication(object):
sts, out, err = (cmdPipe.returncode, cmdData[0].strip(),
cmdData[1].strip())
if sts:
+ self.jobRecord.msg = err
+ self.sess.commit()
genprint("crash problem: err: %s, out: %s" % (err, out))
else:
# The machine running cas isn't capable of processing this core, lets
@@ -295,6 +307,8 @@ class CasApplication(object):
"suitable for processing, please run cas-admin -h " \
"for more information")
else:
+ self.jobRecord.msg = _e[80]
+ self.sess.commit()
return _e[80]
except ImportError:
genprint("Current running machine is not suitable for processing this core " \
@@ -357,12 +371,15 @@ class CasApplication(object):
genprint("Unable to connect to mail server: %s (%s), " \
"no email results sent." % (SMTPHOST,str(e)))
except (os.error, socket.error), e:
+ self.jobRecord.msg = e
+ self.sess.commit()
genprint(e)
+ self.jobRecord.msg = _i[4]
+ self.sess.commit()
genprint("Job on %s complete and located in %s." % (self.filename,
self.storagePath))
# cleanup job
- session.query(job_record).update({job_record.stateId: 2})
- session.commit()
+ self.sess.close()
return
diff --git a/overseer/command.py b/overseer/command.py
index 3f2cfae..6103441 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -24,10 +24,15 @@ import simplejson as json
from caslib.db import *
from mako.template import Template
from mako.lookup import TemplateLookup
+import subprocess
current_dir = os.path.dirname(os.path.abspath(__file__))
mylookup = TemplateLookup(directories=[current_dir + '/static'])
+def run(cmd):
+ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ return p
+
class Root:
@cherrypy.expose
def index(self):
@@ -49,6 +54,13 @@ class Root:
session.add(jobRecord)
session.commit()
record = jobRecord
+ cmd = "cas -i %s -f %s -e %s --job %s" % (record.identifier,
+ record.vmcore,
+ record.email,
+ record.jobId)
+ # push cmd into background and let the cas application handle
+ # any errors
+ run(cmd)
mytemplate = mylookup.get_template("create.html")
return mytemplate.render(record=record)
else:
diff --git a/overseer/static/base.html b/overseer/static/base.html
index 5100dfd..8ae71f2 100644
--- a/overseer/static/base.html
+++ b/overseer/static/base.html
@@ -14,6 +14,7 @@
<a href="/">entrance</a> | <a href="/list">list recent jobs</a>
<hr class="space"/>
${next.body()}
+<hr class="space"/>
<hr/>
2010 Adam Stokes
</div>
diff --git a/overseer/static/index.html b/overseer/static/index.html
index 211c9c6..cf15651 100644
--- a/overseer/static/index.html
+++ b/overseer/static/index.html
@@ -1,10 +1,6 @@
<%inherit file="base.html" />
<hr />
<div class="span-7 colborder">
- <h6>Navigation</h6>
- <ul>
- <li><a href="/">New job</a></li>
- </ul>
<form method="post" id="status_form" action="/status/">
<h6>Enter job id</h6>
<input type="text" name="id" value="" /> <br />
14 years
Branch 'devel' - caslib/cas.py overseer/static
by Adam Stokes
caslib/cas.py | 6 +++++-
overseer/static/list.html | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit 61f74a1731ff5bcb1ce5eda0a594a5dba6fffc3d
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 12 00:01:04 2010 -0400
cosmetic changes; start to think about how to deploy cas workers
diff --git a/caslib/cas.py b/caslib/cas.py
index 1348ba9..b703e66 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -22,7 +22,6 @@ if sys.version_info[:2] < (2,4):
raise SystemExit("Python >= 2.4 required")
try:
from caslib.db import *
- session = Session()
except:
raise SystemExit('Can not interface with database, please check ' \
'configuration settings and try again')
@@ -134,6 +133,8 @@ class CasApplication(object):
parser.add_option("-m","--modules", dest="kernel_modules",
help="Extract associated kernel modules",
action="store_true")
+ parser.add_option("--job", dest="job",
+ help="Define job id")
parser.add_option("--compress", dest="compress_core",
help="Helper option to compress core to be transferred "\
"to another destination.", action="store_true")
@@ -180,6 +181,9 @@ class CasApplication(object):
else:
self.email = self.opts.email
+ if not self.opts.job:
+ parser.error("Job ID missing")
+
self.extractKernelModules = self.opts.kernel_modules
self.storagePath = os.path.join(settings["WORKDIRECTORY"],
self.identifier)
diff --git a/overseer/static/list.html b/overseer/static/list.html
index a48b2d4..6649279 100644
--- a/overseer/static/list.html
+++ b/overseer/static/list.html
@@ -1,5 +1,6 @@
<%inherit file="base.html" />
<h1>Job List</h1>
+<hr />
%for job in job_query:
- ${job.vmcore}<br />
+ ${job.jobId} :: ${job.vmcore}<br />
%endfor
14 years
Branch 'devel' - caslib/db.py overseer/command.py overseer/site.conf overseer/static
by Adam Stokes
caslib/db.py | 4 +--
overseer/command.py | 38 +++++++++++++++++++++--------------
overseer/site.conf | 4 +++
overseer/static/Makefile | 3 +-
overseer/static/base.html | 1
overseer/static/create.html | 3 --
overseer/static/enhance/cas_logo.png |binary
overseer/static/index.html | 1
overseer/static/list.html | 5 ++++
9 files changed, 38 insertions(+), 21 deletions(-)
New commits:
commit 19571db5036c55f34a182abf1b6834dd5fa41f8e
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 11 23:52:42 2010 -0400
overseer work - fixed session handling for sqlite
diff --git a/caslib/db.py b/caslib/db.py
index 3945249..3e74b37 100644
--- a/caslib/db.py
+++ b/caslib/db.py
@@ -128,7 +128,7 @@ class Server(Base):
self.arch)
from sqlalchemy import create_engine
-from sqlalchemy.orm import sessionmaker
+from sqlalchemy.orm import sessionmaker, scoped_session
# Read cas.conf for database path
import ConfigParser
config = ConfigParser.RawConfigParser()
@@ -138,5 +138,5 @@ try:
except:
raise
engine = create_engine("sqlite:////%s" % (dbpath,))
-Session = sessionmaker(bind=engine)
+Session = scoped_session(sessionmaker(bind=engine, autoflush=True))
Base.metadata.create_all(engine)
diff --git a/overseer/command.py b/overseer/command.py
index 748cf06..3f2cfae 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -29,46 +29,54 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
mylookup = TemplateLookup(directories=[current_dir + '/static'])
class Root:
- def __init__(self):
- self.session = Session()
-
@cherrypy.expose
def index(self):
""" Ability to create/query jobs """
+ session = Session()
mytemplate = mylookup.get_template("index.html")
- latest_query = self.session.query(Job).order_by(Job.jobId + "ASC")[0:10]
- self.session.close()
+ latest_query = session.query(Job).order_by(Job.jobId.desc())[0:10]
+ session.close()
return mytemplate.render(recent=latest_query)
@cherrypy.expose
def create(self, **data):
""" Create job """
- if not self.session.query(Job).filter_by(identifier=data['identifier']).first():
+ session = Session()
+ if not session.query(Job).filter_by(identifier=data['identifier']).first():
jobRecord = Job(data['identifier'],
data['email'],
data['vmcore'])
- self.session.add(jobRecord)
- self.session.commit()
- self.session.close()
+ session.add(jobRecord)
+ session.commit()
+ record = jobRecord
mytemplate = mylookup.get_template("create.html")
- attributes = {}
- attributes['jobRecord'] = jobRecord
- return mytemplate.render(attributes=attributes)
+ return mytemplate.render(record=record)
else:
raise cherrypy.HTTPRedirect('/')
@cherrypy.expose
def status(self, **data):
- """ Return job status """
- status_query = self.session.query(Job).filter_by(jobId=data['id']).first()
+ """ Return job stats """
+ session = Session()
+ status_query = session.query(Job).filter_by(jobId=data['id']).first()
mytemplate = mylookup.get_template("status.html")
- self.session.close()
+ session.close()
if status_query:
return mytemplate.render(status=status_query)
else:
return mytemplate.render(errors={'error' : 'Job Not Found'})
+ @cherrypy.expose
+ def list(self):
+ """ list all jobs """
+ session = Session()
+ job_query = session.query(Job).order_by(Job.jobId.desc()).all()
+ session.close()
+ mytemplate = mylookup.get_template("list.html")
+ return mytemplate.render(job_query=job_query)
+
+
def main():
root = Root()
cherrypy.config.update(current_dir + "/site.conf")
diff --git a/overseer/site.conf b/overseer/site.conf
index 73bbf7e..7f53b5d 100644
--- a/overseer/site.conf
+++ b/overseer/site.conf
@@ -14,3 +14,7 @@ tools.staticdir.root = "/usr/share/cas/overseer/static"
[/media]
tools.staticdir.on = True
tools.staticdir.dir = "blueprint"
+
+[/enhance]
+tools.staticdir.on = True
+tools.staticdir.dir = "enhance"
diff --git a/overseer/static/Makefile b/overseer/static/Makefile
index 094d02a..66b3426 100644
--- a/overseer/static/Makefile
+++ b/overseer/static/Makefile
@@ -9,6 +9,7 @@ clean:
install:
mkdir -p $(DESTDIR)$(PKGDIR)/blueprint
- mkdir -p $(DESTDIR)$(PKGDIR)/tmpl
+ mkdir -p $(DESTDIR)$(PKGDIR)/enhance
install -m644 blueprint/*.css $(DESTDIR)$(PKGDIR)/blueprint/.
install -m644 *.html $(DESTDIR)$(PKGDIR)/.
+ install -m644 enhance/*.png $(DESTDIR)$(PKGDIR)/enhance/.
diff --git a/overseer/static/base.html b/overseer/static/base.html
index 48aa5a6..5100dfd 100644
--- a/overseer/static/base.html
+++ b/overseer/static/base.html
@@ -10,6 +10,7 @@
</head>
<body class="index">
<div class="container">
+<h1><img src="/enhance/cas_logo.png"/> - Overseer</h1>
<a href="/">entrance</a> | <a href="/list">list recent jobs</a>
<hr class="space"/>
${next.body()}
diff --git a/overseer/static/create.html b/overseer/static/create.html
index f121458..21c9af9 100644
--- a/overseer/static/create.html
+++ b/overseer/static/create.html
@@ -3,6 +3,5 @@
<div class="container">
<h1>Job creation complete.</h1>
<hr />
- Next steps are to check on the status of <a href="/status/${attributes['jobRecord'].jobId}">your job</a>.
- <hr />
+ Next steps are to check on the status of <a href="/status/?id=${record.jobId}">your job</a>.
</div>
diff --git a/overseer/static/enhance/cas_logo.png b/overseer/static/enhance/cas_logo.png
new file mode 100644
index 0000000..39e2302
Binary files /dev/null and b/overseer/static/enhance/cas_logo.png differ
diff --git a/overseer/static/index.html b/overseer/static/index.html
index c7213ed..211c9c6 100644
--- a/overseer/static/index.html
+++ b/overseer/static/index.html
@@ -1,5 +1,4 @@
<%inherit file="base.html" />
- <h1>CAS - Overseer</h1>
<hr />
<div class="span-7 colborder">
<h6>Navigation</h6>
diff --git a/overseer/static/list.html b/overseer/static/list.html
new file mode 100644
index 0000000..a48b2d4
--- /dev/null
+++ b/overseer/static/list.html
@@ -0,0 +1,5 @@
+<%inherit file="base.html" />
+<h1>Job List</h1>
+%for job in job_query:
+ ${job.vmcore}<br />
+%endfor
14 years
Branch 'devel' - caslib/db.py overseer/command.py overseer/static
by Adam Stokes
caslib/db.py | 2 +-
overseer/command.py | 7 ++++---
overseer/static/index.html | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
New commits:
commit 2986e75814f45742c3775bb612ed850a32747671
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 11 16:48:23 2010 -0400
webui
diff --git a/caslib/db.py b/caslib/db.py
index 3d97495..3945249 100644
--- a/caslib/db.py
+++ b/caslib/db.py
@@ -137,6 +137,6 @@ try:
dbpath = config.get('settings','database')
except:
raise
-engine = create_engine('sqlite:///%s' % (dbpath,))
+engine = create_engine("sqlite:////%s" % (dbpath,))
Session = sessionmaker(bind=engine)
Base.metadata.create_all(engine)
diff --git a/overseer/command.py b/overseer/command.py
index b8f8930..748cf06 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -36,7 +36,8 @@ class Root:
def index(self):
""" Ability to create/query jobs """
mytemplate = mylookup.get_template("index.html")
- latest_query = self.session.query(Job).order_by(Job.created)[0:10]
+ latest_query = self.session.query(Job).order_by(Job.jobId + "ASC")[0:10]
+ self.session.close()
return mytemplate.render(recent=latest_query)
@cherrypy.expose
@@ -48,7 +49,7 @@ class Root:
data['vmcore'])
self.session.add(jobRecord)
self.session.commit()
- self.session.flush()
+ self.session.close()
mytemplate = mylookup.get_template("create.html")
attributes = {}
attributes['jobRecord'] = jobRecord
@@ -61,7 +62,7 @@ class Root:
""" Return job status """
status_query = self.session.query(Job).filter_by(jobId=data['id']).first()
mytemplate = mylookup.get_template("status.html")
- self.session.flush()
+ self.session.close()
if status_query:
return mytemplate.render(status=status_query)
diff --git a/overseer/static/index.html b/overseer/static/index.html
index f25d9bf..c7213ed 100644
--- a/overseer/static/index.html
+++ b/overseer/static/index.html
@@ -34,6 +34,6 @@
import os
vmcoreBasename = os.path.basename(job.vmcore)
%>
- ${job.jobId} :: ${vmcoreBasename}<br />
+ <a href="/status/?id=${job.jobId}">${job.jobId} :: ${vmcoreBasename}</a><br />
%endfor
</div>
14 years
Branch 'devel' - overseer/static
by Adam Stokes
overseer/static/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e7274022797dff87677bc88d21b8609adcd943a1
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 11 15:31:42 2010 -0400
webui updates
diff --git a/overseer/static/index.html b/overseer/static/index.html
index 4de9dac..f25d9bf 100644
--- a/overseer/static/index.html
+++ b/overseer/static/index.html
@@ -8,7 +8,7 @@
</ul>
<form method="post" id="status_form" action="/status/">
<h6>Enter job id</h6>
- <input type="text" name="jobid" value="" /> <br />
+ <input type="text" name="id" value="" /> <br />
<input type="submit" value="Query JOB" />
</form>
</div>
14 years
Branch 'devel' - overseer/command.py overseer/static
by Adam Stokes
overseer/command.py | 37 +++++++++++++++++++++++--------------
overseer/static/base.html | 20 ++++++++++++++++++++
overseer/static/create.html | 8 ++++++++
overseer/static/index.html | 30 ++++++++----------------------
overseer/static/status.html | 23 +++++++++++++++++++++++
5 files changed, 82 insertions(+), 36 deletions(-)
New commits:
commit 2a0dc32900b9064bcb17675567db39ba961b63b9
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 11 15:29:12 2010 -0400
webui updates
diff --git a/overseer/command.py b/overseer/command.py
index 245c68b..b8f8930 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -25,17 +25,19 @@ from caslib.db import *
from mako.template import Template
from mako.lookup import TemplateLookup
-mylookup = TemplateLookup(directories=['static'])
+current_dir = os.path.dirname(os.path.abspath(__file__))
+mylookup = TemplateLookup(directories=[current_dir + '/static'])
class Root:
- def __init__(self, session):
- self.session = session
+ def __init__(self):
+ self.session = Session()
@cherrypy.expose
def index(self):
""" Ability to create/query jobs """
mytemplate = mylookup.get_template("index.html")
- return mytemplate.render()
+ latest_query = self.session.query(Job).order_by(Job.created)[0:10]
+ return mytemplate.render(recent=latest_query)
@cherrypy.expose
def create(self, **data):
@@ -46,23 +48,30 @@ class Root:
data['vmcore'])
self.session.add(jobRecord)
self.session.commit()
- cherrypy.session['status_msg'] = 'Job Posted Successfully'
- raise cherrypy.HTTPRedirect('/')
+ self.session.flush()
+ mytemplate = mylookup.get_template("create.html")
+ attributes = {}
+ attributes['jobRecord'] = jobRecord
+ return mytemplate.render(attributes=attributes)
else:
- cherrypy.session['status_msg'] = 'Job already exists.'
+ raise cherrypy.HTTPRedirect('/')
@cherrypy.expose
def status(self, **data):
""" Return job status """
- pass
+ status_query = self.session.query(Job).filter_by(jobId=data['id']).first()
+ mytemplate = mylookup.get_template("status.html")
+ self.session.flush()
+
+ if status_query:
+ return mytemplate.render(status=status_query)
+ else:
+ return mytemplate.render(errors={'error' : 'Job Not Found'})
def main():
- session = Session()
- root = Root(session)
- current_dir = os.path.dirname(os.path.abspath(__file__))
- cherrypy.config.update("site.conf")
- cherrypy.tree.mount(root, '/', "site.conf")
- cherrypy.server.quickstart()
+ root = Root()
+ cherrypy.config.update(current_dir + "/site.conf")
+ cherrypy.tree.mount(root, '/', current_dir + "/site.conf")
cherrypy.engine.start()
if __name__=="__main__":
diff --git a/overseer/static/base.html b/overseer/static/base.html
new file mode 100644
index 0000000..48aa5a6
--- /dev/null
+++ b/overseer/static/base.html
@@ -0,0 +1,20 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <title>CAS - Overseer</title>
+ <link rel="stylesheet" href="/media/screen.css" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="/media/print.css" type="text/css" media="print" />
+ <!--[if lt IE 8]>
+ <link rel="stylesheet" href="/media/blueprint/ie.css" type="text/css" media="screen, projection" />
+ <![endif]-->
+</head>
+<body class="index">
+<div class="container">
+<a href="/">entrance</a> | <a href="/list">list recent jobs</a>
+<hr class="space"/>
+${next.body()}
+ <hr/>
+ 2010 Adam Stokes
+</div>
+</body>
+</html>
diff --git a/overseer/static/create.html b/overseer/static/create.html
new file mode 100644
index 0000000..f121458
--- /dev/null
+++ b/overseer/static/create.html
@@ -0,0 +1,8 @@
+<%inherit file="base.html"/>
+
+<div class="container">
+ <h1>Job creation complete.</h1>
+ <hr />
+ Next steps are to check on the status of <a href="/status/${attributes['jobRecord'].jobId}">your job</a>.
+ <hr />
+</div>
diff --git a/overseer/static/index.html b/overseer/static/index.html
index 62583eb..4de9dac 100644
--- a/overseer/static/index.html
+++ b/overseer/static/index.html
@@ -1,15 +1,4 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <title>CAS - Overseer</title>
- <link rel="stylesheet" href="/media/screen.css" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="/media/print.css" type="text/css" media="print" />
- <!--[if lt IE 8]>
- <link rel="stylesheet" href="/media/blueprint/ie.css" type="text/css" media="screen, projection" />
- <![endif]-->
-</head>
-<body class="index">
-<div class="container">
+<%inherit file="base.html" />
<h1>CAS - Overseer</h1>
<hr />
<div class="span-7 colborder">
@@ -25,10 +14,6 @@
</div>
<div class="span-10 colborder">
<h4>Setup CAS job</h4>
- <h6>
- <span class="notice">
- </span>
- </h6>
<p>
<form method="post" action="/create/">
<h6>E-Mail</h6>
@@ -44,10 +29,11 @@
<div class="span-5 last">
<h6>Recent CAS Jobs</h6>
+ %for job in recent:
+ <%
+ import os
+ vmcoreBasename = os.path.basename(job.vmcore)
+ %>
+ ${job.jobId} :: ${vmcoreBasename}<br />
+ %endfor
</div>
- <hr/>
- 2010 Adam Stokes
-</div>
-
-</body>
-</html>
diff --git a/overseer/static/status.html b/overseer/static/status.html
new file mode 100644
index 0000000..40d06b5
--- /dev/null
+++ b/overseer/static/status.html
@@ -0,0 +1,23 @@
+<%inherit file="base.html"/>
+<div class="container">
+ %if status:
+ <h1>Job Status #${status.jobId}</h1>
+ <hr />
+ <h6>ID</h6>
+ ${status.jobId}
+ <h6>E-mail</h6>
+ ${status.email}
+ <h6>vmcore</h6>
+ ${status.vmcore}
+ <h6>path</h6>
+ ${status.path}
+ <h6>message</h6>
+ ${status.msg}
+ <h6>created</h6>
+ ${status.created}
+ %else:
+ <h1>Error in job processing</h1>
+ <hr />
+ ${errors['error']}
+ %endif
+</div>
14 years