Esempio n. 1
0
 def cancel_job(self,job):
     success = mig.cancel_job(job["id"])
     if success: 
         #print "Cancelled job : "+job["id"]
         log(self.logfile,"Cancelled job : "+job["id"],self.debug_mode)
     else:
         log(self.logfile,"Unsuccesful cancellation of job :"+job["id"],self.debug_mode)
Esempio n. 2
0
def main():
    printheader()
    form = cgi.FieldStorage()
    params = {}
    for key in form:
        params[key] = form.getvalue(key)

    search = []
    for param in params:
        if param in fields:
            for word in params.get(param).split():
                search.append(u"%s = (%s)" % (param, unicode(word, "utf-8")))
    search = u" and ".join(search)
    search = search or unicode(params.get("query", ""), "utf-8")

    if len(search) is 0:
        printbody(searchform)
    elif params.get("singleRecord", False):
        result = bibdkRequest(search, params.get("startRecord", "1"), 1)
        printbody(printrecord(result))
    else:
        result = bibdkRequest(search, params.get("startRecord", "1"))
        printbody(printrecords(result))

    printfooter()
    import mylogger
    mylogger.log("")
Esempio n. 3
0
 def create_mig_jobs(self,jobs):
     log(self.logfile, "Creating "+str(len(jobs))+" jobs", self.debug_mode)
          
     for j in jobs:
         self.create_mig_job(j)
         print "migsession: mig job created"
     return jobs
Esempio n. 4
0
 def remove_local_files(self,files):
   #clean up
     for f in files:
         #try: 
         os.remove(f)
         
     log(self.logfile, "Removed files locally : "+str(files), self.debug_mode)
Esempio n. 5
0
    def create_mig_job(self,job):
        self.validate_job(job)

        job["id"]= mig.create_job(exec_commands=job["commands"], input_files=job["input_files"],                                     
                                      output_files=job["output_files"],
                                      resource_specifications=job["resource_specs"])
        job["started"] = self.get_time()
        log(self.logfile,"Job created. Id :"+job["id"])
Esempio n. 6
0
 def clean_up_job(self,job):
     job_files = []
     job_files.extend(job["input_files"]) # r files
     if job["status"]["STATUS"] == "FINISHED":
         outputfile = job["job_dir"]+job["output_files"][0]
         job_files.append(outputfile)
     
     log(self.logfile, "Cleaning up for job (id:"+job["id"]+")")
     mig.remove_files(job_files)
     self.remove_local_files(job_files)
Esempio n. 7
0
 def handle_output(self,job):
     #import resultHandle
     files = []
     for f in job["output_files"]:
         output_filename =  f
         outputfile = mig.get_file(output_filename, f)
         log(self.logfile, "Retrieved output file for job "+job["id"],self.debug_mode)
           #print "opening ", destDir+filepath, "to", destDir
         files.append(outputfile)
     return files
Esempio n. 8
0
    entry = db.GqlQuery("SELECT * FROM WordNet WHERE word=:1", word).get()

    if entry != None:
        printEntry(entry)
        return

    entries = db.GqlQuery(
        "SELECT * FROM WordNet WHERE word>:1 ORDER BY word ASC", word).fetch(5)
    entries.extend(
        db.GqlQuery("SELECT * FROM WordNet WHERE word<:1 ORDER BY word DESC",
                    word).fetch(5))
    entries = [str(x.word) for x in entries]
    entries.sort()
    print '<ul>'
    for entry in entries:
        print '<li>%s</li>' % (toLink(entry), )
    print "</ul><div>"
    print '<a href="thesaurus?word=%s+">prev</a>' % (entries[0], )
    print '<a href="thesaurus?word=%s+">next</a>' % (entries[-1], )
    print "</div>"


body()
print """
<div class="licenselink"><a href="/about">about</a></div>
</body></html>
"""

import mylogger
mylogger.log(os.environ["REMOTE_ADDR"] + str(word))
Esempio n. 9
0
  7 database and its documentation for any purpose and without fee or  
  8 royalty is hereby granted, provided that you agree to comply with  
  9 the following copyright notice and statements, including the disclaimer,  
  10 and that the same appear on ALL copies of the software, database and  
  11 documentation, including modifications that you make for internal  
  12 use or for distribution.  
  13   
  14 WordNet 3.0 Copyright 2006 by Princeton University.  All rights reserved.  
  15   
  16 THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON  
  17 UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR  
  18 IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON  
  19 UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT-  
  20 ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE  
  21 OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT  
  22 INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR  
  23 OTHER RIGHTS.  
  24   
  25 The name of Princeton University or Princeton may not be used in  
  26 advertising or publicity pertaining to distribution of the software  
  27 and/or database.  Title to copyright in this software, database and  
  28 any associated documentation shall at all times remain with  
  29 Princeton University and LICENSEE agrees to preserve same.  
</pre>
</div>
   </body>
</html>"""
import mylogger
mylogger.log("")

Esempio n. 10
0
                <input type="submit" value="search" name="action" />
            </div>
        </form>
        """
    entry = db.GqlQuery("SELECT * FROM WordNet WHERE word=:1", word).get()

    if entry != None:
        printEntry(entry)
        return

    entries = db.GqlQuery("SELECT * FROM WordNet WHERE word>:1 ORDER BY word ASC", word).fetch(5)
    entries.extend(db.GqlQuery("SELECT * FROM WordNet WHERE word<:1 ORDER BY word DESC", word).fetch(5))
    entries = [str(x.word) for x in entries]
    entries.sort()
    print '<ul>'
    for entry in entries:
        print '<li>%s</li>' % (toLink(entry),)
    print "</ul><div>"
    print '<a href="oldthesaurus?word=%s+">prev</a>' % (entries[0],)
    print '<a href="oldthesaurus?word=%s+">next</a>' % (entries[-1],)
    print "</div>"

body()
print """
<div class="licenselink"><a href="/about">about</a></div>
</body></html>
"""

import mylogger
mylogger.log(os.environ["REMOTE_ADDR"]+str(word))
Esempio n. 11
0
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   <head><title>demo.solsort.dk</title>
         <link rel="stylesheet" href="/static/jquery.mobile.min.css" />
         <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
         <script src="/static/jquery.mobile.min.js"></script>
         <link type="text/css" rel="stylesheet" href="/static/style.css" />
   </head>
   <body>
   <div data-role="page" data-theme="c">
        <div data-role="header"> 
            <h1>demo.solsort.dk</h1> 
            <a href="about" class="ui-btn-right">About</a> 
        </div> 
   <div data-role="content">
         <h2>Development sandbox</h2>

         <ul data-role="listview" data-inset="true" data-dividertheme="a">
            <li data-role="list-divider">Demos</li> 

            <li><h3><a href="thesaurus">Thesaurus</a></h3></li>
            <li><h3><a href="bib">Mobilt bibliotek...</a> </h3>
                <p>(very preliminary/draft/no-relation-to-reality etc.)</p></li>
         </ul>
         <div><strong>Warning: smartphone optimised with some graceful degradation.</strong> These pages uses mobile web development libraries which are still in prerelease and buggy... this means that the pages may render suboptimally (Firefox), or not work (some versions of Internet Explorer). Should in theory work fine on Meego, iPhone, Android, as well as low-end phones with html, but not javascript support. </div>
       </div>
   </div>
   </body>
</html>"""
import mylogger
mylogger.log("")
Esempio n. 12
0
# -*- coding: UTF-8 -*-
#*****************************************************************************
# Title         : config.py
# Author        : Ljz
# Created       : 4th December 2016
# Last Modified : 
# Version       : 1.0
# 
# Description   : support base conf
#*****************************************************************************
import sys,os
from mylogger import log
import hashlib


logger = log('config.py')


class Resource:
    def __init__(self):
        self.ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
        self.orders = self.ROOT_PATH + os.sep + 'orders'
        self.lenderdata = self.ROOT_PATH + os.sep + 'lenderdata'
        self.orders_path=''
        if not os.path.exists(self.ROOT_PATH):  # 创建根目录
            os.makedirs(os.path.join(self.ROOT_PATH, self.orders))
            os.makedirs(os.path.join(self.ROOT_PATH, self.lenderdata, '1'))

    @property
    def get_orders_path(self):
        return self.orders_path