Cronex v0.4.0 Cronex.Job

This module represents a job.

Summary

Functions

Checks if a given %Job{} can run, based on it’s frequency and pid

Creates a %Job{} with a given frequency and task

Creates a %Job{} with the given arguments

Creates a %Job{} with the given interval, frequency, time and task

Runs and updates the pid attribute of a given %Job{}

Validates a given %Job{}

Functions

can_run?(job)

Checks if a given %Job{} can run, based on it’s frequency and pid.

new(frequency, task)

Creates a %Job{} with a given frequency and task.

Check Cronex.Every.every/3 documentation, to view the accepted frequency arguments.

new(arg1, arg2, task)

Creates a %Job{} with the given arguments.

Different argument data types combinations are accepted:

  • When arg1 is an atom and arg2 is a string, they represent the frequency and time respectively.

  • When arg1 is an integer and arg2 is an atom, they represent the interval and frequency respectively.

Check Cronex.Every.every/3 documentation, to view the accepted frequency and time arguments.

new(interval, frequency, time, task)

Creates a %Job{} with the given interval, frequency, time and task.

Check Cronex.Every.every/4 documentation, to view the accepted interval, frequency and time arguments.

run(job, supervisor)

Runs and updates the pid attribute of a given %Job{}.

validate!(job)

Validates a given %Job{}.

Returns the given %Job{} if the job is valid, raises an error if the job is invalid.