33import click
44import orjson
55
6- from sync .api .projects import create_project_recommendation , get_project_recommendation
6+ from sync .api .projects import (
7+ create_project_recommendation ,
8+ get_project_recommendation ,
9+ get_project_submission ,
10+ )
711from sync .cli .util import validate_project
812from sync .config import CONFIG
913from sync .models import DatabricksComputeType , DatabricksPlanType , Platform , Preference
@@ -190,6 +194,7 @@ def create_recommendation(project: dict):
190194@click .argument ("project" , callback = validate_project )
191195@click .argument ("recommendation-id" )
192196def get_recommendation (project : dict , recommendation_id : str ):
197+ """Get a project recommendation"""
193198 rec_response = get_project_recommendation (project ["id" ], recommendation_id )
194199 recommendation = rec_response .result
195200 if recommendation :
@@ -206,6 +211,27 @@ def get_recommendation(project: dict, recommendation_id: str):
206211 click .echo (f"Failed to get recommendation. { rec_response .error } " , err = True )
207212
208213
214+ @click .command
215+ @click .argument ("project" , callback = validate_project )
216+ @click .argument ("submission-id" )
217+ def get_submission (project : dict , submission_id : str ):
218+ """Get a project submission"""
219+ sub_response = get_project_submission (project ["id" ], submission_id )
220+ submission = sub_response .result
221+ if submission :
222+ if submission ["state" ] == "FAILURE" :
223+ click .echo ("Submission generation failed." , err = True )
224+ else :
225+ click .echo (
226+ orjson .dumps (
227+ submission ,
228+ option = orjson .OPT_INDENT_2 | orjson .OPT_NAIVE_UTC | orjson .OPT_UTC_Z ,
229+ )
230+ )
231+ else :
232+ click .echo (f"Failed to get submission. { sub_response .error } " , err = True )
233+
234+
209235@click .command
210236@click .argument ("run-id" )
211237@click .option ("--plan" , type = click .Choice (DatabricksPlanType ), default = DatabricksPlanType .STANDARD )
0 commit comments