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

Implement a scheduling library #2308

Closed
jniles opened this issue Nov 28, 2017 · 1 comment
Closed

Implement a scheduling library #2308

jniles opened this issue Nov 28, 2017 · 1 comment

Comments

@jniles
Copy link
Collaborator

jniles commented Nov 28, 2017

There are many actions we might want to schedule:

  1. Database backups (feat: automated backups w/ AWS S3 #2305)
  2. File synchronization (feature: Upload backups to Google Drive #2071) and uploads.
  3. Emailing reports on a regular basis ((feat) Email pushing report #1766)
  4. Do system checks (such as the "is installed" check in Installation feature for bhima #2299) on reboot.

All of these features require some sort of scheduler that can run at regular intervals such as daily, weekly, and monthly.

A similar feature is already proposed in https://github.com/IMA-WorldHealth/ima-data/issues/61. I'll copy the relevant information here:

Scheduler
We will write a library called "scheduler" that will contain the schedules (monthly, weekly, daily, real time) in cron syntax. This will be stored in an object schedules. Basically:

id schedule label description
1 0 2 * * 0 weekly Weekly - this runs once a week at 2AM on Sunday

We would find a library for Node that handles schedules in a CRON syntax - like node-cron. We would write a small wrapper that allows any modules to use a schedule like this:

const scheduler = require('./lib/scheduler');

scheduler.daily(() => {
  console.log('I will be logged daily');
});

scheduler.weekly(() => {
  console.log('I get fired weekly.');
});

scheduler.custom('* * * * *', () > {
  console.log('I do something every minute');
});

Our backup scripts, email scripts, and anything else we want to schedule would be able to just import the scheduler and then use it as it.

jniles added a commit to jniles/bhima that referenced this issue Nov 28, 2017
This commit implements the email dropdown on reports as a first step
towards automatic email reporting.  The automatic email reports will
depend on a scheduler proposed in IMA-WorldHealth#2308.

The email functionality depends on having a mailgun account. You should
put your mailgun API key and domain in the .env.development file.  Some
defaults for this project have been filled out.

Partially addresses IMA-WorldHealth#1688 and IMA-WorldHealth#1766.
jniles added a commit to jniles/bhima that referenced this issue Nov 30, 2017
This commit implements the email dropdown on reports as a first step
towards automatic email reporting.  The automatic email reports will
depend on a scheduler proposed in IMA-WorldHealth#2308.

The email functionality depends on having a mailgun account. You should
put your mailgun API key and domain in the .env.development file.  Some
defaults for this project have been filled out.

Partially addresses IMA-WorldHealth#1688 and IMA-WorldHealth#1766.
jniles added a commit to jniles/bhima that referenced this issue Dec 3, 2017
This commit implements the email dropdown on reports as a first step
towards automatic email reporting.  The automatic email reports will
depend on a scheduler proposed in IMA-WorldHealth#2308.

The email functionality depends on having a mailgun account. You should
put your mailgun API key and domain in the .env.development file.  Some
defaults for this project have been filled out.

Partially addresses IMA-WorldHealth#1688 and IMA-WorldHealth#1766.
jniles added a commit to jniles/bhima that referenced this issue Dec 3, 2017
This commit implements the email dropdown on reports as a first step
towards automatic email reporting.  The automatic email reports will
depend on a scheduler proposed in IMA-WorldHealth#2308.

The email functionality depends on having a mailgun account. You should
put your mailgun API key and domain in the .env.development file.  Some
defaults for this project have been filled out.

Partially addresses IMA-WorldHealth#1688 and IMA-WorldHealth#1766.
jniles added a commit to jniles/bhima that referenced this issue Dec 3, 2017
This commit implements the email dropdown on reports as a first step
towards automatic email reporting.  The automatic email reports will
depend on a scheduler proposed in IMA-WorldHealth#2308.

The email functionality depends on having a mailgun account. You should
put your mailgun API key and domain in the .env.development file.  Some
defaults for this project have been filled out.

Partially addresses IMA-WorldHealth#1688 and IMA-WorldHealth#1766.
bors bot added a commit that referenced this issue Dec 3, 2017
2310: feat(reports): implement report emailing r=jniles a=jniles

This commit implements the email dropdown on reports as a first step
towards automatic email reporting.  The automatic email reports will
depend on a scheduler proposed in #2308.

The email functionality depends on having a mailgun account. You should
put your mailgun API key and domain in the .env.development file.  Some
defaults for this project have been filled out.

Partially addresses #1688 and #1766.

![emailactivatedindropdown](https://user-images.githubusercontent.com/896472/33365180-9add6914-d4e7-11e7-99ad-0bd9c5ce499e.PNG)
_Fig 1: The Email Link Dropdown_

![emailmodal](https://user-images.githubusercontent.com/896472/33365181-9b0fa924-d4e7-11e7-9336-1051137986d0.PNG)
_Fig 2: The Email Modal.  It defaults to the current user's email address_

![emailreceivedwithattachment](https://user-images.githubusercontent.com/896472/33365182-9b590790-d4e7-11e7-9821-78c2aad0356f.PNG)
_Fig 3: Email in my inbox_
@jniles
Copy link
Collaborator Author

jniles commented May 24, 2018

This was taken care of by adding a dependency on TaskList.

@jniles jniles closed this as completed May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant