<commit_before>#!/usr/bin/env coffee
kue = require 'kue'
jobs = kue.createQueue()

app = module.exports = require('railway').createServer()

if not module.parent
    port = process.env.PORT or 8003
    app.listen port
    console.log "Railway server listening on port %d within %s environment", port, app.settings.env
    
    # setup KUE
    Job = kue.Job
    
    
# BUILD JOBS

    createCheckJob = (mb, delay=0, callback) =>
      job = jobs.create("check mailbox",
        mailbox: mb
        num: 250
        title: "Check of " + mb + " at " + new Date().toUTCString()
      ).delay(delay).save(callback)
       
      job.on 'complete', () ->
        console.log job.data.title + " #" + job.id + " complete"
        createCheckJob mb, 1000 * 60 * 0.5
      job.on 'failed', () ->
        console.log job.data.title + " #" + job.id + " failed"
        createCheckJob mb, 1000 * 60 * 1
      job.on 'progress', (progress) ->
        console.log job.data.title + ' #' + job.id + ' ' + progress + '% complete'
        
    createCheckJobs = =>
      Mailbox.all (err, mbs) =>
        for mb in mbs
          createCheckJob mb, 1000 * 0.5
          
          
    # set-up CRON
    createCheckJobs()
    
    jobs.promote()

    # KUE jobs
    jobs.process "check mailbox", 1, (job, done) ->
      console.log job.data.title + " #" + job.id + " job started"
      (Mailbox job.data.mailbox).getNewMail job.data.num, done
<commit_msg>remove jobs temporary<commit_after>#!/usr/bin/env coffee
kue = require 'kue'
jobs = kue.createQueue()

app = module.exports = require('railway').createServer()

if not module.parent
    port = process.env.PORT or 8003
    app.listen port
    console.log "Railway server listening on port %d within %s environment", port, app.settings.env
    
    # setup KUE
    Job = kue.Job
    
    
# BUILD JOBS

    createCheckJob = (mb, delay=0, callback) =>
      job = jobs.create("check mailbox",
        mailbox: mb
        num: 250
        title: "Check of " + mb + " at " + new Date().toUTCString()
      ).delay(delay).save(callback)
       
      job.on 'complete', () ->
        console.log job.data.title + " #" + job.id + " complete"
        createCheckJob mb, 1000 * 60 * 0.5
      job.on 'failed', () ->
        console.log job.data.title + " #" + job.id + " failed"
        createCheckJob mb, 1000 * 60 * 1
      job.on 'progress', (progress) ->
        console.log job.data.title + ' #' + job.id + ' ' + progress + '% complete'
        
    createCheckJobs = =>
      Mailbox.all (err, mbs) =>
        for mb in mbs
          createCheckJob mb, 1000 * 0.5
          
          
    # set-up CRON
    #createCheckJobs()
    
    #jobs.promote()

    ## KUE jobs
    #jobs.process "check mailbox", 1, (job, done) ->
      #console.log job.data.title + " #" + job.id + " job started"
      #(Mailbox job.data.mailbox).getNewMail job.data.num, done

{'fraction_non_alphanumeric': 0.14137214137214138, 'fraction_numerical': 0.02079002079002079, 'mean_word_length': 2.042149631190727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '174435', 'n_tokens_mistral': 1016, 'n_tokens_neox': 941, 'n_words': 240}