Added methods to verify if workflow contains compute on other peers before setting up admiralty

This commit is contained in:
pb
2025-03-07 16:19:26 +01:00
parent def56e5822
commit 32ce70da6e
5 changed files with 116 additions and 105 deletions

29
main.go
View File

@@ -87,7 +87,7 @@ func main() {
logger.Error().Msg("Could not retrieve workflow " + conf.GetConfig().WorkflowID + " from oc-catalog API")
}
argo_file_path, stepMax, err := new_wf.ExportToArgo(exec.ExecutionsID, conf.GetConfig().Timeout)
builder, argo_file_path, stepMax, err := new_wf.ExportToArgo(exec.ExecutionsID, conf.GetConfig().Timeout)
if err != nil {
logger.Error().Msg("Could not create the Argo file for " + conf.GetConfig().WorkflowID)
logger.Error().Msg(err.Error())
@@ -99,15 +99,20 @@ func main() {
wf_logger = logger.With().Str("argo_name", workflowName).Str("workflow_id", conf.GetConfig().WorkflowID).Str("workflow_execution_id", conf.GetConfig().ExecutionID).Logger()
wf_logger.Debug().Msg("Testing argo name")
if conf.GetConfig().KubeHost == "" {
// Not in a k8s environment, get conf from parameters
fmt.Println("Executes outside of k8s")
executeOutside(argo_file_path, stepMax)
} else {
// Executed in a k8s environment
fmt.Println("Executes inside a k8s")
executeInside(exec.GetID(), "argo", argo_file_path, stepMax)
err = builder.CompleteBuild(exec.ExecutionsID)
if err != nil {
logger.Error().Msg(err.Error())
}
_ = stepMax
// if conf.GetConfig().KubeHost == "" {
// // Not in a k8s environment, get conf from parameters
// fmt.Println("Executes outside of k8s")
// executeOutside(argo_file_path, stepMax)
// } else {
// // Executed in a k8s environment
// fmt.Println("Executes inside a k8s")
// executeInside(exec.GetID(), "argo", argo_file_path, stepMax)
// }
}
// So far we only log the output from
@@ -224,9 +229,9 @@ func loadConfig(is_k8s bool, parser *argparse.Parser) {
o = initOnion(o)
setConf(is_k8s, o, parser)
if !IsValidUUID(conf.GetConfig().ExecutionID) {
logger.Fatal().Msg("Provided ID is not an UUID")
}
// if !IsValidUUID(conf.GetConfig().ExecutionID) {
// logger.Fatal().Msg("Provided ID is not an UUID")
// }
}
func setConf(is_k8s bool, o *onion.Onion, parser *argparse.Parser) {