Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create an instant job? #509

Closed
talexu opened this issue Mar 28, 2019 · 3 comments
Closed

How to create an instant job? #509

talexu opened this issue Mar 28, 2019 · 3 comments

Comments

@talexu
Copy link

talexu commented Mar 28, 2019

Expected Behavior

Create a job, the job will run once immediately.

Actual Behavior

Create a disabled job, then invoke API to run the job, which means that I have to invoke two APIs (POST /jobs, POST /jobs/{job_name}) for instant job.

Specifications

  • Version: 1.2.0
  • Platform: Mac
  • Backend store: Redis
@vcastellm
Copy link
Member

@talexu I don't know if dkron will be the best tool for that use case but you can submit a job to be run in the next few seconds:

run_next=`date '+%FT%T:Z' --date='5 seconds'`

curl localhost:8080/v1/jobs -d "{
  "name": "job1",
  "schedule": "@at $run_next",
  "disabled": true,
  "executor": "shell",
  "executor_config": {
    "command": "echo 'Hello from Dkron'"
  }
}"

@talexu
Copy link
Author

talexu commented Mar 29, 2019

@talexu I don't know if dkron will be the best tool for that use case but you can submit a job to be run in the next few seconds:

run_next=`date '+%FT%T:Z' --date='5 seconds'`

curl localhost:8080/v1/jobs -d "{
  "name": "job1",
  "schedule": "@at $run_next",
  "disabled": true,
  "executor": "shell",
  "executor_config": {
    "command": "echo 'Hello from Dkron'"
  }
}"

@Victorcoder Thank you for your reply. What I am going to develop is a cross-region job schedule system. Each job in a job chain may be run in different data center.
Could you please give me some advices about how to design and implement such kind of system (e.g. framework, storage, infrastructure)?

@talexu talexu closed this as completed Apr 1, 2019
@vcastellm
Copy link
Member

@talexu For an implementation cross-region I would recommend using DynamoDB global table for the backend on AWS and configure 2 dkron clusters in an active-passive fashion, you can work something like that using tags and the proper configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants