Exemple #1
0
    def __init__(self,id_request,logController):

        self.logController = logController
        self.crawlerState='Esperando'
        self.crawlerProgress=0
        self.totalCrawling=0

        self.scraperState='Esperando'
        self.scraperProgress=0
        self.totalScraping=0

        self.IRState='Esperando'
        self.IRProgress=0
        self.totalIR=0

        self.exception= ""

        self.stop=False

        self.state=dict()
        self.id_request = id_request

        self.config = config()
        self.db = self.config.getDbProgress()
        self.cursor = self.db.cursor()


        with db_session:
            estado = WsRequestState(estado = unicode(self.state), stop = False , search_keys = id_request)
            commit()
            flush()

        # para inicializar el estado en la bd
        self.get_progress()
        self.actualizar_estado()
def pending_flush(request):
    """ empties the pending queue without doing anything about the jobs. for debug use. """
    try :
        config = models.config()
    except DeadlineExceededError, e :
        logging.warning( '%s error getting whistler_config' % e)
        logging.warning( traceback.format_exc() )
        return None
def pending(request):
    """ returns json with data for angles."""
    try :
        config = models.config()
    except DeadlineExceededError, e :
        logging.warning( '%s error getting whistler_config' % e)
        logging.warning( traceback.format_exc() )
        return None
def complete(request):
    """ called from poller on sucessful run."""
    config = models.config()
    response = authenticate(request, config)
    if response: return response

    run_id = request.POST.get("run_id")

    run = get_object_or_404(models.AnglesRun, id=run_id)

    try :
        run.completed = datetime.datetime.utcnow()

        # make a post per uploaded file
        for key,infile in request.FILES.items():
            file_name = files.blobstore.create(mime_type='image/png')
            with files.open(file_name, 'a') as f:
              f.write(infile.read())
            files.finalize(file_name)
            blob_key = files.blobstore.get_blob_key(file_name)
            logging.info("Uploaded a file to blob_key %s" % blob_key)

            logging.info("Making a blog post on %s" % run.weavr_token.weavr_url)
            post = run.weavr_token.post("/1/weavr/post/", {
                "category":"article",
                "title": request.POST.get("message"),
                "keywords": "Angles",
                "body" : "<img src='http://weavrs-angles.appspot.com/angles/blob/%s/'>" % blob_key
            })
            run.post_id = post["post_id"]

        run.success = True
        run.error_record = None
        run.save()
    except OAuthForbiddenException, e :
        logging.info( '%s error posting to weavr' % e)
        logging.info( traceback.format_exc() )

        run.success = False
        run.error_record = '%s error posting to weavr' % e
        run.save()
Exemple #5
0
                                     ckpt,
                                     mode='train')
            # test data
            wav_list = glob.glob(os.path.join(FLAGS.test_data_dir, '*wav'))
            util_train.infer_testset(model_graph, sess, audio_length,
                                     word_dict, wav_list, FLAGS.result_dir,
                                     batch_size, ckpter.saver, ckpt)
            # validation stats
            evaluator.stats_validation(ckpt.split('-')[-1])

    sess.close()


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    models.config(parser)
    MODEL_FLAGS, _ = parser.parse_known_args()

    parser.add_argument('--data_url',
                        type=str,
                        default='http://download.tensorflow.org/data/'
                        'speech_commands_v0.01.tar.gz')
    parser.add_argument('--train_data_dir',
                        type=str,
                        default='dataset/train/audio/')
    parser.add_argument('--test_data_dir',
                        type=str,
                        default='dataset/test/audio/')
    parser.add_argument('--result_dir', type=str, default='run')
    parser.add_argument('--log_dir', type=str, default='run/logs')
    parser.add_argument('--ckpt_dir', type=str, default='run/ckpts')