static void getSubmittedFile(struct sqlConnection *conn, struct edwFile *bf, char *submitDir, char *submitUrl, int submitId) /* We know the submission, we know what the file is supposed to look like. Fetch it. * If things go badly catch the error, attach it to the submission record, and then * keep throwing. */ { struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { if (freeSpaceOnFileSystem(edwRootDir) < 2*bf->size) errAbort("No space left in warehouse!!"); int hostId=0, submitDirId = 0; int fd = edwOpenAndRecordInDir(conn, submitDir, bf->submitFileName, submitUrl, &hostId, &submitDirId); int fileId = edwFileFetch(conn, bf, fd, submitUrl, submitId, submitDirId, hostId); close(fd); edwAddQaJob(conn, fileId); tellSubscribers(conn, submitDir, bf->submitFileName, fileId); } errCatchEnd(errCatch); if (errCatch->gotError) { handleSubmitError(conn, submitId, errCatch->message->string); /* The handleSubmitError will keep on throwing. */ } errCatchFree(&errCatch); }
void edwFileResetTags(struct sqlConnection *conn, struct edwFile *ef, char *newTags) /* Reset tags on file, strip out old validation and QA, schedule new validation and QA. */ /* Remove existing QA records and rerun QA agent on given file. */ { long long fileId = ef->id; /* Update database to let people know format revalidation is in progress. */ char query[4*1024]; sqlSafef(query, sizeof(query), "update edwFile set errorMessage = '%s' where id=%lld", "Revalidation in progress.", fileId); sqlUpdate(conn, query); /* Update tags for file in edwFile table. */ sqlSafef(query, sizeof(query), "update edwFile set tags='%s' where id=%lld", newTags, fileId); sqlUpdate(conn, query); /* Get rid of records referring to file in other validation and qa tables. */ sqlSafef(query, sizeof(query), "delete from edwFastqFile where fileId=%lld", fileId); sqlUpdate(conn, query); sqlSafef(query, sizeof(query), "delete from edwQaPairSampleOverlap where elderFileId=%lld or youngerFileId=%lld", fileId, fileId); sqlUpdate(conn, query); sqlSafef(query, sizeof(query), "delete from edwQaPairCorrelation where elderFileId=%lld or youngerFileId=%lld", fileId, fileId); sqlUpdate(conn, query); sqlSafef(query, sizeof(query), "delete from edwQaEnrich where fileId=%lld", fileId); sqlUpdate(conn, query); sqlSafef(query, sizeof(query), "delete from edwQaContam where fileId=%lld", fileId); sqlUpdate(conn, query); sqlSafef(query, sizeof(query), "delete from edwQaRepeat where fileId=%lld", fileId); sqlUpdate(conn, query); sqlSafef(query, sizeof(query), "delete from edwQaPairedEndFastq where fileId1=%lld or fileId2=%lld", fileId, fileId); sqlUpdate(conn, query); /* schedule validator */ edwAddQaJob(conn, ef->id); }