<s> import uuid <EOL> from sqlalchemy . orm import joinedload <EOL> from changes . api . base import APIView <EOL> from changes . api . build_index import create_build <EOL> from changes . constants import Cause <EOL> from changes . models import Build <EOL> class BuildRetryAPIView ( APIView ) : <EOL> def post ( self , build_id ) : <EOL> build = Build . query . options ( <EOL> joinedload ( '<STR_LIT>' , innerjoin = True ) , <EOL> joinedload ( '<STR_LIT>' ) , <EOL> joinedload ( '<STR_LIT:source>' ) . joinedload ( '<STR_LIT>' ) , <EOL> ) . get ( build_id ) <EOL> if build is None : <EOL> return '<STR_LIT>' , <NUM_LIT> <EOL> collection_id = uuid . uuid4 ( ) <EOL> new_build = create_build ( <EOL> project = build . project , <EOL> collection_id = collection_id , <EOL> label = build . label , <EOL> target = build . target , <EOL> message = build . message , <EOL> author = build . author , <EOL> source = build . source , <EOL> cause = Cause . retry , <EOL> ) <EOL> return '<STR_LIT>' , <NUM_LIT> , { '<STR_LIT>' : '<STR_LIT>' . format ( new_build . id . hex ) } </s>
