mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
NOISSUE - Use Constants for Run Events (#243)
* enhance timeline Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * fix: remove redundant event Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * use constant Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * lint Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * use typed constant for status Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * export agent status and state Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * ehance event states Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * use manager states and status Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * move algo-run to agent package Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * replace manager variable with constant Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * add manager states Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * remove typo Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> --------- Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2f4ca414cb
commit
1546fbc4c2
+6
-6
@@ -271,7 +271,7 @@ func (as *agentService) Attestation(ctx context.Context, reportData [ReportDataS
|
||||
}
|
||||
|
||||
func (as *agentService) runComputation() {
|
||||
as.publishEvent("starting", json.RawMessage{})()
|
||||
as.publishEvent(InProgress.String(), json.RawMessage{})()
|
||||
as.sm.logger.Debug("computation run started")
|
||||
defer func() {
|
||||
if as.runError != nil {
|
||||
@@ -284,7 +284,7 @@ func (as *agentService) runComputation() {
|
||||
if err := os.Mkdir(algorithm.ResultsDir, 0o755); err != nil {
|
||||
as.runError = fmt.Errorf("error creating results directory: %s", err.Error())
|
||||
as.sm.logger.Warn(as.runError.Error())
|
||||
as.publishEvent("failed", json.RawMessage{})()
|
||||
as.publishEvent(Failed.String(), json.RawMessage{})()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -297,11 +297,11 @@ func (as *agentService) runComputation() {
|
||||
}
|
||||
}()
|
||||
|
||||
as.publishEvent("in-progress", json.RawMessage{})()
|
||||
as.publishEvent(InProgress.String(), json.RawMessage{})()
|
||||
if err := as.algorithm.Run(); err != nil {
|
||||
as.runError = err
|
||||
as.sm.logger.Warn(fmt.Sprintf("failed to run computation: %s", err.Error()))
|
||||
as.publishEvent("failed", json.RawMessage{})()
|
||||
as.publishEvent(Failed.String(), json.RawMessage{})()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -309,11 +309,11 @@ func (as *agentService) runComputation() {
|
||||
if err != nil {
|
||||
as.runError = err
|
||||
as.sm.logger.Warn(fmt.Sprintf("failed to zip results: %s", err.Error()))
|
||||
as.publishEvent("failed", json.RawMessage{})()
|
||||
as.publishEvent(Failed.String(), json.RawMessage{})()
|
||||
return
|
||||
}
|
||||
|
||||
as.publishEvent("complete", json.RawMessage{})()
|
||||
as.publishEvent(Completed.String(), json.RawMessage{})()
|
||||
|
||||
as.result = results
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user