Skip to content

Commit

Permalink
Initial implementation of Jobs (CFM-245)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Mar 5, 2023
1 parent 9aa6e82 commit e182786
Show file tree
Hide file tree
Showing 2,808 changed files with 89,073 additions and 72,234 deletions.
2 changes: 1 addition & 1 deletion app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"require": {
"php": ">=8.0",
"cakephp/cakephp": "4.3.9",
"cakephp/cakephp": "4.4.*",
"cakephp/migrations": "^3.2",
"cakephp/plugin-installer": "^1.3",
"doctrine/dbal": "^3.3",
Expand Down
1,533 changes: 667 additions & 866 deletions app/composer.lock

Large diffs are not rendered by default.

56 changes: 52 additions & 4 deletions app/config/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"We don't really need an index, but DBAL will create one for all foreign keys if none exists",
"typeIsDefault will make queries using these columns, but rarely and won't usually have enough rows to need the index"
],
"needed": false,
"columns": [ "default_name_type_id" ]
},
"co_settings_i3": { "columns": [ "default_email_address_type_id" ] },
Expand Down Expand Up @@ -166,9 +167,7 @@
"cous_i1": { "columns": [ "co_id" ] },
"cous_i2": { "columns": [ "name" ] },
"cous_i3": { "columns": [ "co_id", "name" ] },
"cous_i4": {
"comment": "We don't really need an index, but DBAL will create one for all foreign keys if none exists",
"columns": [ "parent_id" ]
"cous_i4": { "needed": false, "columns": [ "parent_id" ]
}
}
},
Expand Down Expand Up @@ -273,7 +272,7 @@
"groups_i2": { "columns": [ "co_id", "name" ] },
"groups_i3": { "columns": [ "co_id", "group_type" ] },
"groups_i4": { "columns": [ "cou_id", "group_type" ] },
"groups_i5": { "columns": [ "cou_id" ], "comment": "Not really needed but DBAL autogenerates"}
"groups_i5": { "needed": false, "columns": [ "cou_id" ]}
}
},

Expand Down Expand Up @@ -476,6 +475,55 @@
"history_records_i6": { "columns": [ "group_id" ] },
"history_records_i7": { "columns": [ "actor_api_user_id" ] }
}
},

"jobs": {
"columns": {
"id": {},
"co_id": {},
"plugin": {},
"parameters": { "type": "text" },
"requeue_interval": { "type": "integer" },
"retry_interval": { "type": "integer" },
"requeued_from_job_id": { "type": "integer", "foreignkey": { "table": "jobs", "column": "id" }},
"status": {},
"assigned_host": { "type": "string", "size": 64 },
"assigned_pid": { "type": "integer" },
"register_summary": { "type": "string", "size": 256 },
"start_summary": { "type": "string", "size": 256 },
"finish_summary": { "type": "string", "size": 256 },
"register_time": { "type": "datetime" },
"start_after_time": { "type": "datetime" },
"start_time": { "type": "datetime" },
"finish_time": { "type": "datetime" },
"percent_complete": { "type": "integer" }
},
"indexes": {
"jobs_i1": { "columns": [ "co_id" ] },
"jobs_i3": { "columns": [ "assigned_host", "assigned_pid" ] },
"jobs_i4": { "needed": false, "columns": [ "requeued_from_job_id" ] }
},
"skip-indexes-for-now": {
"jobs_i2": { "columns": [ "co_id", "plugin", "parameters", "status" ] }
}
},

"job_history_records": {
"columns": {
"id": {},
"job_id": { "type": "integer", "foreignkey": { "table": "jobs", "column": "id" }},
"record_key": { "type": "string", "size": 64 },
"person_id": {},
"external_identity_id": {},
"comment": {},
"status": {}
},
"indexes": {
"job_history_records_i1": { "columns": [ "job_id" ] },
"job_history_records_i2": { "columns": [ "person_id" ] },
"job_history_records_i3": { "columns": [ "external_identity_id" ] },
"job_history_records_i4": { "columns": [ "job_id", "record_key" ] }
}
}
},

Expand Down
51 changes: 51 additions & 0 deletions app/resources/locales/en_US/command.po
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,36 @@ msgstr "Loading database schema from active plugin {0}"
msgid "db.schema.plugin.none"
msgstr "No database schema found for active plugin {0}"

msgid "job.process"
msgstr "Processing job {0}"

msgid "job.registered"
msgstr "Registered job {0}"

msgid "job.run.child.done.empty"
msgstr "No jobs left in the queue, queue runner {0} exiting"

msgid "job.run.child.done.max"
msgstr "Queue runner {0} reached maximum number of jobs ({1}), exiting"

msgid "job.run.child.request"
msgstr "Queue runner {0} requesting assignment {1} for CO {2}"

msgid "job.run.child.running"
msgstr "Queue runner {0} processing job ID {1}"

msgid "job.run.max"
msgstr "Reached max queue runner count ({0}), waiting for one to exit"

msgid "job.run.piddone"
msgstr "Queue runner PID {0} completed"

msgid "job.run.start"
msgstr "Launching queue runner {0} (of {1}) for CO {2}"

msgid "job.run.waiting"
msgstr "{0,plural,=1{Waiting for the last queue runner to complete} other{Waiting for # queue runners to complete}}"

msgid "opt.admin-family-name"
msgstr "Family Name of initial platform administrator"

Expand All @@ -51,6 +81,27 @@ msgstr "Username of initial platform administrator"
msgid "opt.force"
msgstr "Force a rerun of setup (only if you know what you are doing)"

msgid "opt.job.co_id"
msgstr "CO ID"

msgid "opt.job.max"
msgstr "Maximum number of concurrent queue runners (use with -r)"

msgid "opt.job.parallel"
msgstr "Number of parallel queue runners per CO (use with -r)"

msgid "opt.job.parameters"
msgstr "Job (plugin) specific parameters"

msgid "opt.job.plugin"
msgstr "Job (plugin) to run"

msgid "opt.job.run"
msgstr "Run the Job queue for the specified CO"

msgid "opt.job.synchronous"
msgstr "Run the requested job synchronously (use with -j)"

msgid "opt.not"
msgstr "Calculate changes but do not apply"

Expand Down
6 changes: 6 additions & 0 deletions app/resources/locales/en_US/controller.po
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ msgstr "{0,plural,=1{History Record} other{History Records}}"
msgid "Identifiers"
msgstr "{0,plural,=1{Identifier} other{Identifiers}}"

msgid "JobHistoryRecords"
msgstr "{0,plural,=1{Job History Record} other{Job History Records}}"

msgid "Jobs"
msgstr "{0,plural,=1{Job} other{Jobs}}"

msgid "Names"
msgstr "{0,plural,=1{Name} other{Names}}"

Expand Down
21 changes: 21 additions & 0 deletions app/resources/locales/en_US/enumeration.po
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ msgstr "All Members"
msgid "GroupTypeEnum.S"
msgstr "Standard"

msgid "JobStatusEnum.A"
msgstr "Assigned"

msgid "JobStatusEnum.CX"
msgstr "Canceled"

msgid "JobStatusEnum.GO"
msgstr "In Progress"

msgid "JobStatusEnum.NT"
msgstr "Notice"

msgid "JobStatusEnum.OK"
msgstr "Complete"

msgid "JobStatusEnum.Q"
msgstr "Queued"

msgid "JobStatusEnum.X"
msgstr "Failed"

msgid "LanguageEnum.af"
msgstr "Afrikaans"

Expand Down
30 changes: 30 additions & 0 deletions app/resources/locales/en_US/error.po
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ msgstr "Cannot read file {0}"
msgid "flash"
msgstr "{0}: {1}"

msgid "Cos.active"
msgstr "Requested CO {0} is not active"

msgid "GroupNestings.active"
msgstr "Group {0} is not active and so cannot be nested"

Expand Down Expand Up @@ -151,6 +154,30 @@ msgstr "{0} must be provided"
msgid "invalid"
msgstr "Invalid value \"{0}\""

msgid "Jobs.failed.abnormal"
msgstr "The Job terminated unexpectedly"

msgid "Jobs.plugin.parameter.int"
msgstr "Provided value is not an integer"

msgid "Jobs.plugin.parameter.invalid"
msgstr "Invalid parameter"

msgid "Jobs.plugin.parameter.required"
msgstr "Required parameter not provided"

msgid "Jobs.plugin.parameter.type"
msgstr "Unknown parameter type {0}"

msgid "Jobs.registered.already"
msgstr "A Job is already registered for this plugin ({0}) with these parameters"

msgid "Jobs.status.invalid"
msgstr "Job {0} is not in {1} status and cannot be set to {2} (Job is {3})"

msgid "Jobs.status.invalid.cancel"
msgstr "Job {0} is not in a cancelable status (Job is {1})"

msgid "Names.minimum"
msgstr "At least one name is required"

Expand Down Expand Up @@ -178,6 +205,9 @@ msgstr "Page number must be an integer"
msgid "perm"
msgstr "Permission Denied"

msgid "Plugins.inactive"
msgstr "The plugin {0} is not active"

msgid "Plugins.inuse"
msgstr "{0,plural,=1{Plugin in use for {1} \"{2}\" in CO {3}} other{Plugin in use for {1} \"{2}\" in CO {3} and others}}"

Expand Down
54 changes: 54 additions & 0 deletions app/resources/locales/en_US/field.po
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ msgstr "Order"
msgid "organization"
msgstr "Organization"

msgid "parameters"
msgstr "Parameters"

msgid "parent_id"
msgstr "Parent"

Expand Down Expand Up @@ -342,6 +345,57 @@ msgstr "Open"
msgid "Groups.open.desc"
msgstr "Open groups may be self-joined by any Person in the CO"

msgid "JobHistoryRecords.record_key"
msgstr "Record Key"

msgid "Jobs.assigned_host"
msgstr "Assigned Host"

msgid "Jobs.assigned_pid"
msgstr "Assigned Process ID"

msgid "Jobs.finish_summary"
msgstr "Finish Summary"

msgid "Jobs.finish_time"
msgstr "Finished"

msgid "Jobs.percent_complete"
msgstr "Percent Complete"

msgid "Jobs.register_summary"
msgstr "Register Summary"

msgid "Jobs.register_time"
msgstr "Registered"

msgid "Jobs.requeue_interval"
msgstr "Requeue Interval"

msgid "Jobs.requeue_interval.desc"
msgstr "After the job successfully completes, it will automatically be requeued to execute after this interval (in seconds). (To stop requeuing, cancel this job.)"

msgid "Jobs.requeued_from_job_id"
msgstr "Requeued From Job"

msgid "Jobs.retry_interval"
msgstr "Retry Interval"

msgid "Jobs.retry_interval.desc"
msgstr "If the job fails, it will automatically be retried after this interval (in seconds). (To stop retrying, cancel this job.)"

msgid "Jobs.start_after_time"
msgstr "Start After"

msgid "Jobs.start_after_time.desc"
msgstr "The queued job will not be started until after this time"

msgid "Jobs.start_summary"
msgstr "Start Summary"

msgid "Jobs.start_time"
msgstr "Started"

msgid "Plugins.plugin"
msgstr "Plugin"

Expand Down
9 changes: 9 additions & 0 deletions app/resources/locales/en_US/result.po
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ msgstr "Removed {0} as an owner of group {1}"
msgid "Names.primary_name"
msgstr "Primary Name Updated"

msgid "Jobs.canceled"
msgstr "Job {0} canceled"

msgid "Jobs.canceled.by"
msgstr "Job canceled by {0}"

msgid "Jobs.registered"
msgstr "Started via JobCommand by {0} (uid {1})"

msgid "saved"
msgstr "Saved"

Expand Down
Loading

0 comments on commit e182786

Please sign in to comment.