-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from VEuPathDB/issue-29
Fix issue #29
- Loading branch information
Showing
4 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/kotlin/org/veupathdb/lib/compute/platform/intern/db/queries/update/queue-job.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.veupathdb.lib.compute.platform.intern.db.queries.update | ||
|
||
import org.veupathdb.lib.hash_id.HashID | ||
import java.sql.Connection | ||
|
||
private const val SQL = """ | ||
UPDATE | ||
compute.jobs | ||
SET | ||
queue = ? | ||
, status = 'queued' | ||
WHERE | ||
job_id = ? | ||
""" | ||
|
||
/** | ||
* Resets the target job to queued in the database. | ||
* | ||
* @param con Open database connection to be used for the query. | ||
* | ||
* @param jobID Hash ID of the job to mark as expired. | ||
* | ||
* @param queue Name of the new queue the job was submitted to. | ||
*/ | ||
internal fun MarkJobQueued(con: Connection, jobID: HashID, queue: String) { | ||
con.prepareStatement(SQL).use { ps -> | ||
ps.setString(1, queue) | ||
ps.setBytes(2, jobID.bytes) | ||
ps.execute() | ||
} | ||
} |