mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
improperly counting successes
This commit is contained in:
1 parent
1d0db0eeb9
commit
83ae73d8d0
3 files changed
+18
-3
No files matched your search
@@ -10,6 +10,7 @@ use mysql_queries::queries::generic_inference::job::mark_generic_inference_job_c
|
||||
use mysql_queries::queries::generic_inference::job::mark_generic_inference_job_failure::mark_generic_inference_job_failure;
|
||||
use std::time::Duration;
|
||||
use filesys::file_exists::file_exists;
|
||||
use crate::job::job_loop::process_single_job_success_case::ProcessSingleJobSuccessCase;
|
||||
|
||||
// Job runner timeouts (guards MySQL)
|
||||
const START_TIMEOUT_MILLIS : u64 = 500;
|
||||
@@ -96,8 +97,19 @@ async fn process_job_batch(job_dependencies: &JobDependencies, jobs: Vec<Availab
|
||||
for job in jobs.into_iter() {
|
||||
let result = process_single_job(job_dependencies, &job).await;
|
||||
match result {
|
||||
Ok(_) => {
|
||||
let _stats = job_dependencies.job_stats.increment_success_count().ok();
|
||||
Ok(success_case) => {
|
||||
info!("Job loop iteration \"success\": {:?}", success_case);
|
||||
|
||||
let increment_success_count = match success_case {
|
||||
ProcessSingleJobSuccessCase::JobCompleted => true,
|
||||
ProcessSingleJobSuccessCase::JobTemporarilySkippedFilesAbsent => false,
|
||||
ProcessSingleJobSuccessCase::JobSkippedForRoutingTagMismatch => false,
|
||||
ProcessSingleJobSuccessCase::LockNotObtained => false,
|
||||
};
|
||||
|
||||
if increment_success_count {
|
||||
let _stats = job_dependencies.job_stats.increment_success_count().ok();
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("Failure to process job: {:?}", e);
|
||||
|
||||
@@ -8,6 +8,9 @@ pub enum ProcessSingleJobError {
|
||||
/// The job is invalid (bad state, etc.)
|
||||
InvalidJob(anyhow::Error),
|
||||
/// The job's keepalive signal has elapsed, so the job needs to be killed.
|
||||
/// The keepalive signal is typically for non-premium users only and it
|
||||
/// makes sure they're still on the website. It kills jobs they leave
|
||||
/// running when they bounce so that we can free up their capacity.
|
||||
KeepAliveElapsed,
|
||||
/// This is any other kind of error.
|
||||
/// It might be important, we just haven't special cased it yet.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum ProcessSingleJobSuccessCase {
|
||||
/// Job was successfully completed.
|
||||
JobCompleted,
|
||||
|
||||
Reference in new issue
Block a user