-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from zhongwencool/refactor
Refactor
- Loading branch information
Showing
26 changed files
with
1,731 additions
and
1,331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
[ | ||
{titan, []}, | ||
{titan, [ | ||
{crontab_jobs, [ | ||
%% {JobName, CrontabSpec, {M, F, A}} | ||
%% {JobName, CrontabSpec, {M, F, A}, StartDateTime, EndDateTime} | ||
%% CrontabSpec | ||
%% 1. "Minute Hour DayOfMonth Month DayOfWeek" | ||
%% 2. "Second Minute Hour DayOfMonth Month DayOfWeek" | ||
%% 3. @yearly | @annually | @monthly | @weekly | @daily | @midnight | @hourly | @minutely | ||
%% 4. @every 1h2m3s | ||
|
||
%% Standard crontab spec without second (default second is 0 not *). | ||
{crontab_job, "*/15 * * * *", {stateless_cron, inspect, ["Runs on 0, 15, 30, 45 minutes"]}}, | ||
%% Extend crontab spec with second. | ||
{extend_crontab_job, "0 0 1-6/2,18 * * *", {stateless_cron, inspect, ["Runs on 1,3,6,18 o'clock"]}}, | ||
%% Crontab spec with alphabet. | ||
{alphabet_job, "@hourly", {stateless_cron, inspect, ["Runs every(0-23) o'clock"]}}, | ||
%% Fixed interval spec. | ||
{fixed_interval_job, "@every 5m", {stateless_cron, inspect, ["Runs every 5 minutes"]}}, | ||
%% Job with startDateTime and EndDateTime. Runs 0-23 o'clock since {11,0,0}. | ||
{limit_datetime_job, "@hourly", {stateless_cron, inspect, ["Runs every(0-23) o'clock"]}, {11, 0, 0}, unlimited}, | ||
%% Job with max run count, default is `unlimited` | ||
{max_run_count_job, "@daily", {stateless_cron, inspect, ["Runs daily"]}, unlimited, unlimited, [{max_count, 1000}]}, | ||
%% Parallel job, singleton default is true. | ||
{no_singleton_job, "@minutely", {timer, sleep, [61000]}, unlimited, unlimited, [{singleton, false}]} | ||
|
||
]} | ||
]}, | ||
{ecron, [ | ||
{time_zone, local}, %% local or utc | ||
{global_quorum_size, 1}, | ||
{global_jobs, [ | ||
{global_crontab_job, "*/15 * * * * *", {stateless_cron, inspect, ["Runs on 0, 15, 30, 45 seconds"]}} | ||
]}, | ||
{local_jobs, [ | ||
%% {JobName, CrontabSpec, {M, F, A}} | ||
%% {JobName, CrontabSpec, {M, F, A}, StartDateTime, EndDateTime} | ||
%% CrontabSpec | ||
%% 1. "Minute Hour DayOfMonth Month DayOfWeek" | ||
%% 2. "Second Minute Hour DayOfMonth Month DayOfWeek" | ||
%% 3. @yearly | @annually | @monthly | @weekly | @daily | @midnight | @hourly | @minutely | ||
%% 4. @every 1h2m3s | ||
|
||
%% Standard crontab spec without second (default second is 0 not *). | ||
{crontab_job, "*/15 * * * *", {stateless_cron, inspect, ["Runs on 0, 15, 30, 45 minutes"]}}, | ||
%% Extend crontab spec with second. | ||
{extend_crontab_job, "0 0 1-6/2,18 * * *", {stateless_cron, inspect, ["Runs on 1,3,6,18 o'clock"]}}, | ||
%% Crontab spec with alphabet. | ||
{alphabet_job, "@hourly", {stateless_cron, inspect, ["Runs every(0-23) o'clock"]}}, | ||
%% Fixed interval spec. | ||
{fixed_interval_job, "@every 5m", {stateless_cron, inspect, ["Runs every 5 minutes"]}}, | ||
%% Job with startDateTime and EndDateTime. Runs 0-23 o'clock since {{2019,9,26},{0,0,0}}. | ||
{limit_datetime_job, "@hourly", {stateless_cron, inspect, ["Runs every(0-23) o'clock"]}, {{2019, 9, 26}, {0, 0, 0}}, unlimited}, | ||
%% Job with max run count, default is `unlimited` | ||
{max_run_count_job, "@daily", {stateless_cron, inspect, ["Runs daily"]}, unlimited, unlimited, [{max_count, 1000}]}, | ||
%% Parallel job, singleton default is true. | ||
{no_singleton_job, "@minutely", {timer, sleep, [61000]}, unlimited, unlimited, [{singleton, false}]} | ||
|
||
]} | ||
]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{"1.1.0", | ||
{"1.2.0", | ||
[{<<"ecron">>,{pkg,<<"ecron">>,<<"0.5.2">>},0}, | ||
{<<"telemetry">>,{pkg,<<"telemetry">>,<<"0.4.0">>},1}]}. | ||
[ | ||
{pkg_hash,[ | ||
{<<"ecron">>, <<"66E092F1E41C6C52DE7C0C88F023ECC0DBE44FBB614BD9BC8ABA38BA5B6DEFF0">>}, | ||
{<<"telemetry">>, <<"8339BEE3FA8B91CB84D14C2935F8ECF399CCD87301AD6DA6B71C09553834B2AB">>}]} | ||
{<<"telemetry">>, <<"8339BEE3FA8B91CB84D14C2935F8ECF399CCD87301AD6DA6B71C09553834B2AB">>}]}, | ||
{pkg_hash_ext,[ | ||
{<<"ecron">>, <<"6FEB15514E9BD60B7696AABA9C405AEA8F950C8CA1D8E1FD4C702A12073F30C6">>}, | ||
{<<"telemetry">>, <<"E9E3CACFD37C1531C0CA70CA7C0C30CE2DBB02998A4F7719DE180FE63F8D41E4">>}]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
-define(MONITOR_WORKER, ecron_monitor). | ||
-define(Job, ecron_local_jobs). | ||
-define(GlobalJob, ecron_global_jobs). | ||
-define(LocalJob, ecron_local). | ||
-define(GlobalJob, ecron_global). | ||
-define(Ecron, ecron). | ||
|
||
-define(MAX_TIMEOUT, 4294967). %% (16#ffffffff div 1000) 49.71 days. | ||
%% (16#ffffffff div 1000) 49.71 days. | ||
-define(MAX_TIMEOUT, 4294967). | ||
-define(Success, [ecron, success]). | ||
-define(Failure, [ecron, failure]). | ||
-define(Activate, [ecron, activate]). | ||
-define(Deactivate, [ecron, deactivate]). | ||
-define(Delete, [ecron, delete]). | ||
-define(GlobalUp, [ecron, global, up]). | ||
-define(GlobalDown, [ecron, global, down]). | ||
-define(GlobalDown, [ecron, global, down]). | ||
|
||
-record(job, { | ||
name, | ||
status = activate, | ||
job, | ||
opts = [], | ||
ok = 0, | ||
failed = 0, | ||
link = undefined, | ||
result = [], | ||
run_microsecond = [] | ||
}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{"1.1.0", | ||
{"1.2.0", | ||
[{<<"telemetry">>,{pkg,<<"telemetry">>,<<"0.4.0">>},0}]}. | ||
[ | ||
{pkg_hash,[ | ||
{<<"telemetry">>, <<"8339BEE3FA8B91CB84D14C2935F8ECF399CCD87301AD6DA6B71C09553834B2AB">>}]} | ||
{<<"telemetry">>, <<"8339BEE3FA8B91CB84D14C2935F8ECF399CCD87301AD6DA6B71C09553834B2AB">>}]}, | ||
{pkg_hash_ext,[ | ||
{<<"telemetry">>, <<"E9E3CACFD37C1531C0CA70CA7C0C30CE2DBB02998A4F7719DE180FE63F8D41E4">>}]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.