@@ -115,22 +115,40 @@ def run_job(self, batch, assume_clean_state):
115115 with tm .utils .ExperimentSession (self .experiment_id ) as session :
116116 sites = session .query (tm .Site .id , tm .Site .height , tm .Site .width , tm .Site .y , tm .Site .x ).\
117117 filter_by (well_id = well_id ).all ()
118+
119+ sites_id = [i [0 ] for i in sites ] #list of site ids for this well
120+
121+ logger .debug (
122+ 'well_id: %s has site_id: %s'
123+ , well_id , len (sites ))
124+
118125 wellY = sites [0 ][1 ]* len (set ([i [3 ] for i in sites ]))
119126 wellX = sites [0 ][2 ]* len (set ([i [4 ]for i in sites ]))
120-
121-
122127 extract_mapobject_type_id = session .query (tm .MapobjectType .id ).\
123128 filter_by (name = batch ['extract_object' ]).one ()[0 ]
129+
130+ logger .debug (
131+ 'id of %s is: %s '
132+ , batch ['extract_object' ], extract_mapobject_type_id )
133+
124134 extract_seg_layer_id = session .query (tm .SegmentationLayer .id ).\
125135 filter_by (mapobject_type_id = extract_mapobject_type_id ).one ()[0 ]
136+
126137 extract_centroids = session .query (tm .MapobjectSegmentation .geom_centroid ,tm .MapobjectSegmentation .mapobject_id ,tm .MapobjectSegmentation .label ,tm .MapobjectSegmentation .partition_key ).\
127- filter_by (segmentation_layer_id = extract_seg_layer_id ).all ()
138+ filter (tm .MapobjectSegmentation .segmentation_layer_id == extract_seg_layer_id ).\
139+ filter (tm .MapobjectSegmentation .partition_key .in_ (sites_id ) ).all ()
140+
141+ logger .debug (
142+ 'well_id: %s has %s sites and a total of %s centroids'
143+ , well_id , len (sites ), len (extract_centroids ))
144+
128145 assign_mapobject_type_id = session .query (tm .MapobjectType .id ).\
129146 filter_by (name = batch ['assign_object' ]).one ()[0 ]
130147 assign_seg_layer_id = session .query (tm .SegmentationLayer .id ).\
131148 filter_by (mapobject_type_id = assign_mapobject_type_id ).one ()[0 ]
132149 assign_centroids = session .query (tm .MapobjectSegmentation .geom_centroid ,tm .MapobjectSegmentation .mapobject_id ,tm .MapobjectSegmentation .label ,tm .MapobjectSegmentation .partition_key ).\
133- filter_by (segmentation_layer_id = assign_seg_layer_id ).all ()
150+ filter (tm .MapobjectSegmentation .segmentation_layer_id == assign_seg_layer_id ).\
151+ filter (tm .MapobjectSegmentation .partition_key .in_ (sites_id ) ).all ()
134152
135153 logger .info ('Calculating LCC for well_id %s' , well_id )
136154 logger .info ('Instantiating LCC for extract_object' )
0 commit comments