@@ -46,7 +46,7 @@ import scala.util.Try
4646case class ExtractorMessage (
4747 msgid : UUID ,
4848 fileId : UUID ,
49- jobId : UUID ,
49+ jobId : Option [ UUID ] ,
5050 notifies : List [String ],
5151 intermediateId : UUID ,
5252 host : String ,
@@ -431,13 +431,13 @@ class RabbitmqPlugin(application: Application) extends Plugin {
431431 * @param file_id the UUID of file
432432 * @param extractor_id the extractor queue name to be submitted
433433 */
434- def postSubmissionEven (file_id : UUID , extractor_id : String ): (UUID , UUID ) = {
434+ def postSubmissionEven (file_id : UUID , extractor_id : String ): (UUID , Option [ UUID ] ) = {
435435 val extractions : ExtractionService = DI .injector.getInstance(classOf [ExtractionService ])
436436
437437 import java .text .SimpleDateFormat
438438 val dateFormatter = new SimpleDateFormat (" yyyy-MM-dd'T'HH:mm:ssX" )
439439 val submittedDateConvert = new java.util.Date ()
440- val job_id = UUID .generate()
440+ val job_id = Some ( UUID .generate() )
441441 extractions.insert(Extraction (UUID .generate(), file_id, job_id, extractor_id, " SUBMITTED" , submittedDateConvert, None )) match {
442442 case Some (objectid) => (UUID (objectid.toString), job_id)
443443 case None => (UUID (" " ), job_id)
@@ -487,7 +487,7 @@ class RabbitmqPlugin(application: Application) extends Plugin {
487487 val msg = ExtractorMessage (id, file.id, job_id, notifies, file.id, host, queue, extraInfo, file.length.toString,
488488 d.id, " " , apiKey, routingKey, source, " created" , None )
489489 extractWorkQueue(msg)
490- jobId = Option ( job_id)
490+ jobId = job_id
491491 }
492492 jobId
493493 }
@@ -609,7 +609,7 @@ class RabbitmqPlugin(application: Application) extends Plugin {
609609 * @param newFlags
610610 */
611611 def submitFileManually (originalId : UUID , file : File , host : String , queue : String , extraInfo : Map [String , Any ],
612- datasetId : UUID , newFlags : String , requestAPIKey : Option [String ], user : Option [User ]): UUID = {
612+ datasetId : UUID , newFlags : String , requestAPIKey : Option [String ], user : Option [User ]): Option [ UUID ] = {
613613 Logger .debug(s " Sending message to $queue from $host with extraInfo $extraInfo" )
614614 val apiKey = getApiKey(requestAPIKey, user)
615615 val sourceExtra = JsObject ((Seq (" filename" -> JsString (file.filename))))
@@ -632,7 +632,7 @@ class RabbitmqPlugin(application: Application) extends Plugin {
632632 * @param newFlags
633633 */
634634 def submitDatasetManually (host : String , queue : String , extraInfo : Map [String , Any ], datasetId : UUID , newFlags : String ,
635- requestAPIKey : Option [String ], user : Option [User ]): UUID = {
635+ requestAPIKey : Option [String ], user : Option [User ]): Option [ UUID ] = {
636636 Logger .debug(s " Sending message $queue from $host with extraInfo $extraInfo" )
637637 val apiKey = getApiKey(requestAPIKey, user)
638638 val source = Entity (ResourceRef (ResourceRef .dataset, datasetId), None , JsObject (Seq .empty))
@@ -964,13 +964,13 @@ class PendingRequestCancellationActor(exchange: String, connection: Option[Conne
964964 val extractions : ExtractionService = DI .injector.getInstance(classOf [ExtractionService ])
965965 val dateFormatter = new SimpleDateFormat (" yyyy-MM-dd'T'HH:mm:ssX" )
966966 var startDate = new java.util.Date ()
967- val job_id : UUID = extractions.get(msg_id) match {
967+ val job_id : Option [ UUID ] = extractions.get(msg_id) match {
968968 case Some (extraction) => {
969969 extraction.job_id
970970 }
971971 case None => {
972972 Logger .warn(" Failed to lookup jobId.. no extraction message found with id=" + msg_id)
973- UUID ( " " )
973+ None
974974 }
975975 }
976976 extractions.insert(Extraction (UUID .generate(), id, job_id, queueName, " Cancel Requested" , startDate, None ))
@@ -1111,7 +1111,7 @@ class PublishDirectActor(channel: Channel, replyQueueName: String) extends Actor
11111111 " notifies" -> Json .toJson(notifies),
11121112 " msgid" -> Json .toJson(msgid.stringify),
11131113 " id" -> Json .toJson(fileid.stringify),
1114- " jobid" -> Json .toJson(jobid.stringify),
1114+ " jobid" -> Json .toJson(jobid.get. stringify),
11151115 " intermediateId" -> Json .toJson(intermediateId.stringify),
11161116 " fileSize" -> Json .toJson(fileSize),
11171117 " host" -> Json .toJson(actualHost),
@@ -1189,7 +1189,10 @@ class EventFilter(channel: Channel, queue: String) extends Actor {
11891189 Logger .debug(" Received extractor status: " + statusBody)
11901190 val json = Json .parse(statusBody)
11911191 val file_id = UUID ((json \ " file_id" ).as[String ])
1192- val job_id = UUID ((json \ " job_id" ).as[String ])
1192+ val job_id : Option [UUID ] = (json \ " job_id" ).asOpt[String ] match {
1193+ case Some (jid) => { Some (UUID (jid)) }
1194+ case None => { None }
1195+ }
11931196 val extractor_id = (json \ " extractor_id" ).as[String ]
11941197 val status = (json \ " status" ).as[String ]
11951198 val startDate = (json \ " start" ).asOpt[String ].map(x =>
0 commit comments