本文整理汇总了Python中job.Job.name方法的典型用法代码示例。如果您正苦于以下问题:Python Job.name方法的具体用法?Python Job.name怎么用?Python Job.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_job
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
def do_job(self, line):
conn = self.conn()
if conn:
#print "Line = %s" % line
r = cmd.Cmd.parseline(self, line)
print "job = " , r
if r[0] and r[1]:
print "Sending JOB : %s" % r[0]
conn.send('job')
## On doit recevoir Ok send your job
print "Srv => ", conn.recv()
j=Job()
j.name=r[0]
j.cmd=r[1]
conn.send(j)
## On doit recevoir Job receiveing ou erreur "
print "Srv => ", conn.recv()
## On doit recevoir Job job finish"
print "Srv => ", conn.recv()
## On doit recevoir le job
j = conn.recv()
## On doit recevoir Invite de fin OK see your soon"
print "Srv => ", conn.recv()
## la connexion doit se terminer
## Affichage du resultat
j.pr()
else:
print "Job incorrecte [%s] [%s]" % (r[0], r[1])
else:
print "Not connected"
## Dans tout les cas la connexion est ferme
conn=None
示例2: _add_gc_job
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
def _add_gc_job(self):
job = Job()
job.name = 'gc'
job.job_func= self.gc
job.set_frequency(10, 'minutes')
self._add_job(job)
self.instantiate(job)
示例3: render
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
def render(self, request):
if request.args.has_key("string"):
string = request.args["string"][0]
j = Job()
j.name = "JOB 0001"
j.cmd = string
self.worker.job = j
self.worker.work()
#rc, err, out, cmd, ilog = self.worker.work(string)
rc = j.returncode
err = j.stderr
out = j.stdout
cmd = j.cmd
ilog = j.ilog
else:
rc, err, out, cmd, ilog = ( 0, "", "", "<>", [] )
rep = """
<html><body><form>
<input type='text' name='string' value='%s' />
<input type='submit' value='Go' />
"""
rep += "<hr/>"
rep += "<table border=1>"
rep += "<tr>"
rep += "<th> Libelle </th>"
rep += "<th> Valeur </th>"
rep += "</tr>"
rep += "<tr>"
rep += "<td> Commande </td>"
rep += "<td> %s </td>" % cmd
rep += "</tr>"
rep += "<tr>"
rep += "<td> stderr </td>"
rep += "<td> %s </td>" % err
rep += "</tr>"
rep += "<tr>"
rep += "<td> stdout </td>"
rep += "<td> %s </td>" % out
rep += "</tr>"
for l in ilog:
rep += "<tr>"
rep += "<td></td>"
rep += "<td> %s </td>" % l
rep += "</tr>"
rep += "</table>"
rep += """
</form></body></html>
"""
return rep
示例4: do_batch
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
def do_batch(self, line):
#print "Line = %s" % line
r = cmd.Cmd.parseline(self, line)
#print "job = " , r
if r[0] and r[1]:
conn = self.conn()
## la il faut passer la main
## a process
j = Job()
j.name = r[0]
j.cmd = r[1]
b = Process(target=run_batch, args=(j,conn,self.b_list))
b.start()
else:
print "Job incorrecte [%s] [%s]" % (r[0], r[1])
示例5: lineReceived
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
def lineReceived(self, line):
if hasattr(self, 'handle_' + line):
getattr(self, 'handle_' + line)()
else:
## ce n'est une fonction interne
## donc c'est une commande a passer
## on doit creer un job
j = Job()
j.name = "JOB 0001"
j.cmd = line
self.factory.worker.job = j
self.factory.worker.work()
#rc, err, out, cmd, ilog = self.factory.worker.work()
self.sendLine( "Commande : %s " % j.cmd )
self.sendLine( "Return Code = %s " % j.returncode )
if j.stderr:
self.sendLine( "Err = %s" % j.stderr )
if j.stdout:
self.sendLine( "Out = %s" % j.stdout )
for l in j.ilog:
self.sendLine( "> %s " % l )
示例6: Client
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
import sys
from multiprocessing.connection import Client
from array import array
from job import Job
address = ('localhost', 6000)
conn = Client(address, authkey='secret password')
print conn.recv() # Entete du serveur
if sys.argv[1]:
conn.send(sys.argv[1])
else:
j=Job()
j.name='TEST'
j.cmd="ls -l"
conn.send(j)
print conn.recv() # Entete du serveur
conn.close()
示例7: Client
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import name [as 别名]
SERVEUR='localhost'
PORT=6000
PASSWORD='secret password'
address = (SERVEUR, PORT)
conn = Client(address, authkey=PASSWORD)
print conn.recv() # Entete du serveur
if len(sys.argv) > 1 :
cmd=sys.argv[1]
if cmd == 'j1':
print "Cli : JOB1"
conn.send('job')
print "Srv => ", conn.recv()
j=Job()
j.name='TYPE JOB 1'
j.cmd="ls -l ; sleep 55"
#j.cmd="ls -l "
conn.send(j)
j = conn.recv()
j.pr()
conn.close()
elif cmd == 'j2':
print "Cli : JOB2"
conn.send('job')
print "Srv => ", conn.recv()
j=Job()
j.name='TYPE JOB 2'
j.cmd="ls -l ; sleep 25"
#j.cmd="ls -l "
conn.send(j)