Git Product home page Git Product logo

cronj's People

Contributors

dm3 avatar pyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cronj's Issues

Just a simple thank you

Thanks for writing and providing cronj, Chris. We're using it in production and the simulation capability is proving indispensible!

task feign death

my project used cronj for auto task,but have an issue it is that the task feign death , none log to print, what's happen with it?

handler hang up bug

if pre-hook had exception ,there is no capture,which will cause handler to hang up. so that other all tasks will hang up too.

Changelog

Hi,

Would you please add a changelog.

Thanks!

Timezone

Hi,

Is there a way to specify the timezone in which the cronj should interpret the crontab specs?

Thanks,
R

Correct way to import

Total newbie to Clojure here, and i'd like to ask you what is the proper way to import cronj?

The only way (yeah i tried a lot) to work for me was:

(ns starter.core
  (:require [cronj.core :refer :all])
  (:gen-class))

Which just dont feels right.

Also maybe it would be usefull to add a tip about it to documentation.

Thanks!

EOF while reading version 0.1.0

In my project.clj I have included [cronj "0.1.0"], and lein deps retrieves the package fine. But when I run lein repl I get:

Exception in thread "main" java.lang.RuntimeException: EOF while reading, starting at line 185, compiling:(cronj/core.clj:307)
    at clojure.lang.Compiler.compile(Compiler.java:7190)
    at clojure.lang.RT.compile(RT.java:387)
    at clojure.lang.RT.load(RT.java:427)
    at clojure.lang.RT.load(RT.java:400)
    at clojure.core$load$fn__4890.invoke(core.clj:5415)
    at clojure.core$load.doInvoke(core.clj:5414)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5227)
    at clojure.core$load_lib.doInvoke(core.clj:5264)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:603)
    at clojure.core$load_libs.doInvoke(core.clj:5298)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:603)
    at clojure.core$require.doInvoke(core.clj:5381)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at cumtd_api$loading__4784__auto__.invoke(cumtd_api.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3382)
    at clojure.lang.Compiler.compile1(Compiler.java:7035)
    at clojure.lang.Compiler.compile1(Compiler.java:7025)
    at clojure.lang.Compiler.compile(Compiler.java:7097)
    at clojure.lang.RT.compile(RT.java:387)
    at clojure.lang.RT.load(RT.java:427)
    at clojure.lang.RT.load(RT.java:400)
    at clojure.core$load$fn__4890.invoke(core.clj:5415)
    at clojure.core$load.doInvoke(core.clj:5414)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5227)
    at clojure.core$compile$fn__4895.invoke(core.clj:5426)
    at clojure.core$compile.invoke(core.clj:5425)
    at user$eval7.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:6511)
    at clojure.lang.Compiler.eval(Compiler.java:6501)
    at clojure.lang.Compiler.eval(Compiler.java:6477)
    at clojure.core$eval.invoke(core.clj:2797)
    at clojure.main$eval_opt.invoke(main.clj:297)
    at clojure.main$initialize.invoke(main.clj:316)
    at clojure.main$null_opt.invoke(main.clj:349)
    at clojure.main$main.doInvoke(main.clj:427)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: EOF while reading, starting at line 185
    at clojure.lang.Util.runtimeException(Util.java:170)
    at clojure.lang.LispReader.readDelimitedList(LispReader.java:1117)
    at clojure.lang.LispReader$ListReader.invoke(LispReader.java:962)
    at clojure.lang.LispReader.read(LispReader.java:180)
    at clojure.lang.Compiler.compile(Compiler.java:7094)
    ... 45 more
Compilation failed: Subprocess failed

Am I doing something wrong, or is there an error in the version of cronj I’ve downloaded? I’m using Clojure 1.4.0 and Leiningen 2.0.0-preview8.

Stack Overflow using schedule-task function

I'm using cronj with Stuart Sierra's component library, and am running into a bit of a problem.

I'm planning to run a number of tasks, each of which are contained within their own component. Currently, I initialize all of those first, and then have the scheduler depend upon all of the task components.

Logically, I would rather start the scheduler first, and then have each task schedule itself upon initialization.

After perusing the cronj source, I came upon the schedule-task function, which seems to allow for this kind of functionality. I would start the scheduler with an empty vector of entries, and then attempt to call schedule-task with the cronj instance and task -- resulting in a SO.

schedule-task is not present in the documentation, but does seem to be part of a public api. Am I using it incorrectly, or is it not ready for prime-time?

I'm happy to create a sample repo demonstrating this.

Task to check healthiness of task-scheduler

I'm using cronj as a substitute of cron for a clojure project. When using cron on other projects I always have a task that run every hour and create some entry log, so I know that cron is no broken (sometimes because a bad entry definition). Is there a way in cronj to define a task that have access to the task-scheduler without doing the following?:

(declare cj)

(defn handler []
  (let [workflows-task (cronj/get-task cj "start-workflows-task")]
    {:running (cronj/running? cj)
     :uptime (cronj/uptime cj)
     :tasks (cronj/get-ids cj)
     :start-workflows-enabled (:enabled workflows-task)
     :start-workflows-schedule (:schedule workflows-task)}))

(def log-cronj-status-task
  {:id "log-cronj-status-task"
   :handler handler
   :schedule "0 0 1 * * * *"
   :opt {}})

(def cj (cronj/cronj :entries [log-cronj-status-task]))

Declaring cj in the environment just for the purpose of handler can access to it, feels hacky to me, but I cannot see a way around it other than pass the task-scheduler reference as a parameter on the task definition.

Thanks! and FR

First - thanks for this.

Second, it would be really useful to manually start a scheduled task, but to ensure that only one execution was happening at a time, so if the scheduled task was running then nothing would happen or alternatively this request would be queued. And conversely, if it is running manually then the scheduled task is a no-op/queued.

I could achieve this with an atom but I thought I would ask here.

Adding/removing tasks for started scheduler

Is there a possibility to add a task with a schedule for a started scheduler? I have two cases where this would be great to have:

  • the scheduler starts than other components can add their schedules, they would share the same one scheduler, otherwise probably I'd need to start up new scheduler for every case
  • there are some delayed jobs which should be executed after several minutes or hours. These are executed only once. These are things like failed job retries. After the task is executed, it can be removed from the list of tasks

Thank you for answer.

in repl can't stop task

in repl can't stop task
when I Loading src/automation/temp1.clj... done
the task can't stop or shutdown

Task persistence mechanism

What do you think about adding a persistence mechanism to cronj? By persistence I mean the ability to resume tasks from the last shutdown of the scheduler.

Do you think it's a viable idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.