@@ -62,73 +62,77 @@ def insert_dials_align_strategies(self, dcid, crystal_symmetry, results):
6262 chi = "%.2f" % chi
6363 phi = "%.2f" % phi
6464
65- # Step 1: Add new record to Screening table, keep the ScreeningId
66- d = {
67- "dcid" : dcid ,
68- "programversion" : "dials.align_crystal" ,
69- "comments" : settings_str ,
70- "shortcomments" : "dials.align_crystal %i" % solution_id ,
71- "ispyb_command" : "insert_screening" ,
72- "store_result" : "ispyb_screening_id_%i" % solution_id ,
73- }
74- ispyb_command_list .append (d )
75-
76- # Step 2: Store screeningOutput results, linked to the screeningId
65+ # Step 1: Store screeningOutput results, linked to the screeningId
7766 # Keep the screeningOutputId
7867 d = {
7968 "program" : "dials.align_crystal" ,
8069 "indexingsuccess" : 1 ,
8170 "strategysuccess" : 1 ,
8271 "alignmentsuccess" : 1 ,
8372 "ispyb_command" : "insert_screening_output" ,
84- "screening_id" : "$ispyb_screening_id_%i" % solution_id ,
85- "store_result" : "ispyb_screening_output_id_%i" % solution_id ,
73+ "screening_id" : "$ispyb_screening_id" ,
74+ "store_result" : f "ispyb_screening_output_id_{ solution_id } " ,
8675 }
8776 ispyb_command_list .append (d )
8877
89- # Step 3 : Store screeningOutputLattice results, linked to the screeningOutputId
78+ # Step 2 : Store screeningOutputLattice results, linked to the screeningOutputId
9079 # Keep the screeningOutputLatticeId
9180 d = {
9281 "ispyb_command" : "insert_screening_output_lattice" ,
93- "screening_output_id" : "$ispyb_screening_output_id_%i" % solution_id ,
94- "store_result" : "ispyb_screening_output_lattice_id_%i" % solution_id ,
82+ "screening_output_id" : f "$ispyb_screening_output_id_{ solution_id } " ,
83+ "store_result" : f "ispyb_screening_output_lattice_id_{ solution_id } " ,
9584 }
9685 uc_params = crystal_symmetry .unit_cell ().parameters ()
9786 for i , p in enumerate (("a" , "b" , "c" , "alpha" , "beta" , "gamma" )):
9887 d ["unitcell%s" % p ] = uc_params [i ]
9988 d ["spacegroup" ] = crystal_symmetry .space_group_info ().type ().lookup_symbol ()
10089 ispyb_command_list .append (d )
10190
102- # Step 4 : Store screeningStrategy results, linked to the screeningOutputId
91+ # Step 3 : Store screeningStrategy results, linked to the screeningOutputId
10392 # Keep the screeningStrategyId
10493 d = {
105- "program" : "dials.align_crystal %i" % solution_id ,
94+ "program" : "dials.align_crystal" ,
10695 "ispyb_command" : "insert_screening_strategy" ,
107- "screening_output_id" : "$ispyb_screening_output_id_%i" % solution_id ,
108- "store_result" : "ispyb_screening_strategy_id_%i" % solution_id ,
96+ "screening_output_id" : f "$ispyb_screening_output_id_{ solution_id } " ,
97+ "store_result" : f "ispyb_screening_strategy_id_{ solution_id } " ,
10998 }
11099 ispyb_command_list .append (d )
111100
112- # Step 5 : Store screeningStrategyWedge results, linked to the screeningStrategyId
101+ # Step 4 : Store screeningStrategyWedge results, linked to the screeningStrategyId
113102 # Keep the screeningStrategyWedgeId
114103 d = {
115104 "wedgenumber" : 1 ,
116105 "phi" : phi ,
117106 "chi" : chi ,
118107 "comments" : settings_str ,
119108 "ispyb_command" : "insert_screening_strategy_wedge" ,
120- "screening_strategy_id" : "$ispyb_screening_strategy_id_%i"
121- % solution_id ,
122- "store_result" : "ispyb_screening_strategy_wedge_id_%i" % solution_id ,
109+ "screening_strategy_id" : f"$ispyb_screening_strategy_id_{ solution_id } " ,
110+ "store_result" : f"ispyb_screening_strategy_wedge_id_{ solution_id } " ,
123111 }
124112 ispyb_command_list .append (d )
125113
126114 if ispyb_command_list :
127- self .log .debug ("Sending %s" , json .dumps (ispyb_command_list , indent = 2 ))
128- self .recwrap .send_to ("ispyb" , {"ispyb_command_list" : ispyb_command_list })
129- self .log .info ("Sent %d commands to ISPyB" , len (ispyb_command_list ))
115+ d = {
116+ "ispyb_command" : "update_processing_status" ,
117+ "program_id" : "$ispyb_autoprocprogram_id" ,
118+ "message" : "Processing successful" ,
119+ "status" : "success" ,
120+ }
121+ ispyb_command_list .append (d )
122+
130123 else :
131- self .log .info ("There is no valid dials.align_crystal strategy here" )
124+ d = {
125+ "ispyb_command" : "update_processing_status" ,
126+ "program_id" : "$ispyb_autoprocprogram_id" ,
127+ "message" : "No achievable alignment within range of goniometer" ,
128+ "status" : "failure" ,
129+ }
130+ ispyb_command_list .append (d )
131+ self .log .info ("No achievable alignment within range of goniometer" )
132+
133+ self .log .debug ("Sending %s" , json .dumps (ispyb_command_list , indent = 2 ))
134+ self .recwrap .send_to ("ispyb" , {"ispyb_command_list" : ispyb_command_list })
135+ self .log .info ("Sent %d commands to ISPyB" , len (ispyb_command_list ))
132136
133137 def construct_commandline (self , params ):
134138 """Construct dlstbx.align_crystal command line.
@@ -232,5 +236,6 @@ def run(self):
232236 )
233237 else :
234238 self .log .warning ("Expected JSON output file missing" )
239+ return False
235240
236241 return True
0 commit comments