@@ -888,7 +888,8 @@ pub async fn create_job(
888888 challenge_id : & str ,
889889) -> Result < EvaluationJob > {
890890 let client = pool. get ( ) . await ?;
891- let job_id = Uuid :: new_v4 ( ) . to_string ( ) ;
891+ let job_uuid = Uuid :: new_v4 ( ) ;
892+ let sub_uuid = Uuid :: parse_str ( submission_id) ?;
892893 let now = chrono:: Utc :: now ( ) . timestamp ( ) ;
893894
894895 // Get submission details
@@ -902,8 +903,8 @@ pub async fn create_job(
902903 source_code, api_key, api_provider, challenge_id, status, created_at)
903904 VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 'pending', NOW())" ,
904905 & [
905- & job_id ,
906- & submission_id ,
906+ & job_uuid ,
907+ & sub_uuid ,
907908 & sub. agent_hash ,
908909 & sub. miner_hotkey ,
909910 & sub. source_code ,
@@ -915,7 +916,7 @@ pub async fn create_job(
915916 . await ?;
916917
917918 Ok ( EvaluationJob {
918- id : job_id ,
919+ id : job_uuid . to_string ( ) ,
919920 submission_id : submission_id. to_string ( ) ,
920921 agent_hash : sub. agent_hash ,
921922 miner_hotkey : sub. miner_hotkey ,
@@ -961,8 +962,8 @@ pub async fn claim_next_job(
961962 . await ?;
962963
963964 Ok ( row. map ( |r| EvaluationJob {
964- id : r. get ( 0 ) ,
965- submission_id : r. get ( 1 ) ,
965+ id : r. get :: < _ , Uuid > ( 0 ) . to_string ( ) ,
966+ submission_id : r. get :: < _ , Uuid > ( 1 ) . to_string ( ) ,
966967 agent_hash : r. get ( 2 ) ,
967968 miner_hotkey : r. get ( 3 ) ,
968969 source_code : r. get :: < _ , Option < String > > ( 4 ) . unwrap_or_default ( ) ,
@@ -979,6 +980,7 @@ pub async fn claim_next_job(
979980/// Get a job by ID
980981pub async fn get_job ( pool : & Pool , job_id : & str ) -> Result < Option < EvaluationJob > > {
981982 let client = pool. get ( ) . await ?;
983+ let job_uuid = Uuid :: parse_str ( job_id) ?;
982984 let row = client
983985 . query_opt (
984986 "SELECT id, submission_id, agent_hash, miner_hotkey, source_code,
@@ -987,15 +989,15 @@ pub async fn get_job(pool: &Pool, job_id: &str) -> Result<Option<EvaluationJob>>
987989 status, assigned_validator,
988990 EXTRACT(EPOCH FROM assigned_at)::BIGINT as assigned_at
989991 FROM evaluation_jobs WHERE id = $1" ,
990- & [ & job_id ] ,
992+ & [ & job_uuid ] ,
991993 )
992994 . await ?;
993995
994996 Ok ( row. map ( |r| {
995997 let status_str: String = r. get ( 9 ) ;
996998 EvaluationJob {
997- id : r. get ( 0 ) ,
998- submission_id : r. get ( 1 ) ,
999+ id : r. get :: < _ , Uuid > ( 0 ) . to_string ( ) ,
1000+ submission_id : r. get :: < _ , Uuid > ( 1 ) . to_string ( ) ,
9991001 agent_hash : r. get ( 2 ) ,
10001002 miner_hotkey : r. get ( 3 ) ,
10011003 source_code : r. get :: < _ , Option < String > > ( 4 ) . unwrap_or_default ( ) ,
@@ -1025,6 +1027,7 @@ pub async fn update_job_progress(
10251027 status : & str ,
10261028) -> Result < ( ) > {
10271029 let client = pool. get ( ) . await ?;
1030+ let job_uuid = Uuid :: parse_str ( job_id) ?;
10281031 client
10291032 . execute (
10301033 "UPDATE evaluation_jobs SET
@@ -1033,7 +1036,7 @@ pub async fn update_job_progress(
10331036 last_progress = $3,
10341037 updated_at = NOW()
10351038 WHERE id = $1" ,
1036- & [ & job_id , & ( task_index as i32 ) , & status] ,
1039+ & [ & job_uuid , & ( task_index as i32 ) , & status] ,
10371040 )
10381041 . await ?;
10391042 Ok ( ( ) )
@@ -1042,10 +1045,11 @@ pub async fn update_job_progress(
10421045/// Mark job as completed
10431046pub async fn complete_job ( pool : & Pool , job_id : & str ) -> Result < ( ) > {
10441047 let client = pool. get ( ) . await ?;
1048+ let job_uuid = Uuid :: parse_str ( job_id) ?;
10451049 client
10461050 . execute (
10471051 "UPDATE evaluation_jobs SET status = 'completed', updated_at = NOW() WHERE id = $1" ,
1048- & [ & job_id ] ,
1052+ & [ & job_uuid ] ,
10491053 )
10501054 . await ?;
10511055 Ok ( ( ) )
0 commit comments