@@ -8,21 +8,18 @@ use pyo3::{
88} ;
99
1010use futures:: { stream:: BoxStream , StreamExt , TryStreamExt } ;
11+ use opsqueue:: {
12+ common:: errors:: E :: { self , L , R } ,
13+ object_store:: { ChunksStorageError , NewObjectStoreClientError } ,
14+ producer:: client:: { Client as ActualClient , InternalProducerClientError } ,
15+ } ;
1116use opsqueue:: {
1217 common:: { chunk, submission, StrategicMetadataMap } ,
1318 object_store:: { ChunkRetrievalError , ChunkType } ,
1419 producer:: common:: ChunkContents ,
1520 tracing:: CarrierMap ,
1621 E ,
1722} ;
18- use opsqueue:: {
19- common:: {
20- errors:: E :: { self , L , R } ,
21- NonZeroIsZero ,
22- } ,
23- object_store:: { ChunksStorageError , NewObjectStoreClientError } ,
24- producer:: client:: { Client as ActualClient , InternalProducerClientError } ,
25- } ;
2623use ux_serde:: u63;
2724
2825use crate :: {
@@ -163,6 +160,9 @@ impl ProducerClient {
163160 } )
164161 }
165162
163+ /// Directly inserts a submission without sending the chunks to GCS
164+ /// (but immediately embedding them in the DB).
165+ /// NOTE: This does not support StrategicMetadata currently
166166 #[ pyo3( signature = ( chunk_contents, metadata=None , chunk_size=None , otel_trace_carrier=CarrierMap :: default ( ) ) ) ]
167167 pub fn insert_submission_direct (
168168 & self ,
@@ -172,7 +172,6 @@ impl ProducerClient {
172172 chunk_size : Option < u64 > ,
173173 otel_trace_carrier : CarrierMap ,
174174 ) -> CPyResult < SubmissionId , E < FatalPythonException , InternalProducerClientError > > {
175- // TODO
176175 let strategic_metadata = Default :: default ( ) ;
177176
178177 py. allow_threads ( || {
@@ -208,7 +207,6 @@ impl ProducerClient {
208207 SubmissionId ,
209208 E ! [
210209 FatalPythonException ,
211- NonZeroIsZero <chunk:: ChunkIndex >,
212210 ChunksStorageError ,
213211 InternalProducerClientError ,
214212 ] ,
@@ -227,7 +225,7 @@ impl ProducerClient {
227225 self . object_store_client
228226 . store_chunks ( & prefix, ChunkType :: Input , stream)
229227 . await
230- . map_err ( |e| CError ( R ( R ( L ( e) ) ) ) )
228+ . map_err ( |e| CError ( R ( L ( e) ) ) )
231229 } )
232230 } ) ?;
233231 let chunk_count = chunk:: ChunkIndex :: from ( chunk_count) ;
@@ -250,7 +248,7 @@ impl ProducerClient {
250248 tracing:: debug!( "Submitting finished; Submission ID {submission_id} assigned to subfolder {prefix}" ) ;
251249 submission_id. into ( )
252250 } )
253- . map_err ( |e| R ( R ( R ( e ) ) ) . into ( ) )
251+ . map_err ( |e| R ( R ( e ) ) . into ( ) )
254252 } )
255253 } )
256254 }
@@ -269,7 +267,6 @@ impl ProducerClient {
269267 InternalProducerClientError ,
270268 ] ,
271269 > {
272- // TODO: Use CPyResult instead
273270 py. allow_threads ( || {
274271 self . block_unless_interrupted ( async move {
275272 match self
@@ -299,7 +296,6 @@ impl ProducerClient {
299296 E ! [
300297 FatalPythonException ,
301298 errors:: SubmissionFailed ,
302- NonZeroIsZero <chunk:: ChunkIndex >,
303299 ChunksStorageError ,
304300 InternalProducerClientError ,
305301 ] ,
@@ -325,7 +321,7 @@ impl ProducerClient {
325321 CError ( match e {
326322 L ( e) => L ( e) ,
327323 R ( L ( e) ) => R ( L ( e) ) ,
328- R ( R ( e) ) => R ( R ( R ( R ( e ) ) ) ) ,
324+ R ( R ( e) ) => R ( R ( R ( e ) ) ) ,
329325 } )
330326 } ) ?;
331327 Ok ( res)
0 commit comments