comparison Core/JobsEngine/JobsEngine.cpp @ 2811:7cfc8d266f41

reason for releasing resources in jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Sep 2018 12:32:02 +0200
parents d26dd081df97
children ea7aea6f6a95
comparison
equal deleted inserted replaced
2810:1e8c4ecd02f4 2811:7cfc8d266f41
53 { 53 {
54 assert(running.IsValid()); 54 assert(running.IsValid());
55 55
56 if (running.IsPauseScheduled()) 56 if (running.IsPauseScheduled())
57 { 57 {
58 running.GetJob().ReleaseResources(); 58 running.GetJob().ReleaseResources(JobReleaseReason_Paused);
59 running.MarkPause(); 59 running.MarkPause();
60 return false; 60 return false;
61 } 61 }
62 62
63 if (running.IsCancelScheduled()) 63 if (running.IsCancelScheduled())
64 { 64 {
65 running.GetJob().ReleaseResources(); 65 running.GetJob().ReleaseResources(JobReleaseReason_Canceled);
66 running.MarkCanceled(); 66 running.MarkCanceled();
67 return false; 67 return false;
68 } 68 }
69 69
70 JobStepResult result; 70 JobStepResult result;
87 } 87 }
88 88
89 switch (result.GetCode()) 89 switch (result.GetCode())
90 { 90 {
91 case JobStepCode_Success: 91 case JobStepCode_Success:
92 running.GetJob().ReleaseResources(JobReleaseReason_Success);
92 running.UpdateStatus(ErrorCode_Success); 93 running.UpdateStatus(ErrorCode_Success);
93 running.GetJob().ReleaseResources();
94 running.MarkSuccess(); 94 running.MarkSuccess();
95 return false; 95 return false;
96 96
97 case JobStepCode_Failure: 97 case JobStepCode_Failure:
98 running.GetJob().ReleaseResources(); 98 running.GetJob().ReleaseResources(JobReleaseReason_Failure);
99 running.UpdateStatus(result.GetFailureCode()); 99 running.UpdateStatus(result.GetFailureCode());
100 running.MarkFailure(); 100 running.MarkFailure();
101 return false; 101 return false;
102 102
103 case JobStepCode_Retry: 103 case JobStepCode_Retry:
104 running.GetJob().ReleaseResources(); 104 running.GetJob().ReleaseResources(JobReleaseReason_Retry);
105 running.UpdateStatus(ErrorCode_Success); 105 running.UpdateStatus(ErrorCode_Success);
106 running.MarkRetry(result.GetRetryTimeout()); 106 running.MarkRetry(result.GetRetryTimeout());
107 return false; 107 return false;
108 108
109 case JobStepCode_Continue: 109 case JobStepCode_Continue: