Changeset: f9b2da9175da for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9b2da9175da
Modified Files:
sql/backends/monet5/bamloader/bam_db_interface.c
sql/backends/monet5/bamloader/bam_globals.h
sql/backends/monet5/bamloader/bam_loader.c
sql/backends/monet5/bamloader/bam_wrapper.c
Branch: bamloader
Log Message:
Stick # in front of log message and log in single fprintf calls.
diffs (196 lines):
diff --git a/sql/backends/monet5/bamloader/bam_db_interface.c
b/sql/backends/monet5/bamloader/bam_db_interface.c
--- a/sql/backends/monet5/bamloader/bam_db_interface.c
+++ b/sql/backends/monet5/bamloader/bam_db_interface.c
@@ -222,7 +222,7 @@ create_schema_if_not_exists(Client cntxt
snprintf(sql_create_schema, 64, "CREATE SCHEMA %s;", schemaname);
- TO_LOG("<bam_loader> Creating schema '%s'...", schemaname);
+ TO_LOG("#<bam_loader> Creating schema '%s'...\n", schemaname);
RUN_SQL(cntxt, &sql_create_schema, descr, msg);
if(msg != MAL_SUCCEED) {
REUSE_EXCEPTION(msg, MAL, "create_schema_if_not_exists", "Could
not create bam schema: %s", msg);
@@ -247,7 +247,7 @@ create_table_if_not_exists(Client cntxt,
sql_table *result;
str msg;
if((result = mvc_bind_table(m, s, tablename)) == NULL) {
- TO_LOG("<bam_loader> Creating table '%s'...", tablename);
+ TO_LOG("#<bam_loader> Creating table '%s'...\n", tablename);
RUN_SQL(cntxt, &sql_creation, descr, msg);
if(msg != MAL_SUCCEED) {
diff --git a/sql/backends/monet5/bamloader/bam_globals.h
b/sql/backends/monet5/bamloader/bam_globals.h
--- a/sql/backends/monet5/bamloader/bam_globals.h
+++ b/sql/backends/monet5/bamloader/bam_globals.h
@@ -31,10 +31,7 @@
/* Macro that enables writing to a log. If the debug flag is not set, it does
not do anything */
#ifdef BAM_DEBUG
-#define TO_LOG(...) { \
- fprintf(stderr, __VA_ARGS__); \
- fprintf(stderr, "\n"); \
-}
+#define TO_LOG(...) fprintf(stderr, __VA_ARGS__)
#else
#define TO_LOG(...) (void)0
#endif
diff --git a/sql/backends/monet5/bamloader/bam_loader.c
b/sql/backends/monet5/bamloader/bam_loader.c
--- a/sql/backends/monet5/bamloader/bam_loader.c
+++ b/sql/backends/monet5/bamloader/bam_loader.c
@@ -96,33 +96,33 @@ run_process_bam_alignments(void *d) {
reader_thread_data *data = (reader_thread_data *)d;
bam_wrapper *bw;
- TO_LOG("<Thread %d> Starting on next file...", data->thread_id);
+ TO_LOG("#<Thread %d> Starting on next file...\n", data->thread_id);
/* First, find out on which bam wrapper we have to work */
MT_lock_set(data->reader_lock, data->reader_lock_ref);
if(*data->cur_file == data->nr_files - 1) {
/* The last file is already (being) processed, this thread is done */
MT_lock_unset(data->reader_lock, data->reader_lock_ref);
- TO_LOG("<Thread %d> No files left to work on; thread done",
data->thread_id);
+ TO_LOG("#<Thread %d> No files left to work on; thread done\n",
data->thread_id);
return;
}
(*data->cur_file) += 1;
bw = &data->bws[*data->cur_file];
MT_lock_unset(data->reader_lock, data->reader_lock_ref);
- TO_LOG("<Thread %d> Processing alignments of file '%s' (file id
"LLFMT")...", data->thread_id, bw->file_location, bw->file_id);
+ TO_LOG("#<Thread %d> Processing alignments of file '%s' (file id
"LLFMT")...\n", data->thread_id, bw->file_location, bw->file_id);
if((data->msg = process_bam_alignments(bw, data->failure)) != MAL_SUCCEED)
{
- TO_LOG("<Thread %d> Error while processing alignments of file '%s'
(file id "LLFMT") (%s)", data->thread_id, bw->file_location, bw->file_id,
data->msg);
+ TO_LOG("#<Thread %d> Error while processing alignments of file '%s'
(file id "LLFMT") (%s)\n", data->thread_id, bw->file_location, bw->file_id,
data->msg);
REUSE_EXCEPTION(data->msg, MAL, "run_process_bam_alignments", "Error
while processing alignments of file '%s' (file id "LLFMT"): %s",
bw->file_location, bw->file_id, data->msg);
return;
}
if(*data->failure) {
/* process_bam_alignments returned because another thread failed and
not because this thread failed */
- TO_LOG("<Thread %d> Exit due to failure in other thread",
data->thread_id);
+ TO_LOG("#<Thread %d> Exit due to failure in other thread\n",
data->thread_id);
return;
}
- TO_LOG("<Thread %d> All alignments in file '%s' (file id "LLFMT")
processed!", data->thread_id, bw->file_location, bw->file_id);
+ TO_LOG("#<Thread %d> All alignments in file '%s' (file id "LLFMT")
processed!\n", data->thread_id, bw->file_location, bw->file_id);
run_process_bam_alignments(d);
}
@@ -150,7 +150,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
int i, errnr;
str msg = MAL_SUCCEED;
- TO_LOG("<bam_loader>: Loader started for %d BAM file%s...", nr_files,
(nr_files != 1 ? "s" : ""));
+ TO_LOG("#<bam_loader>: Loader started for %d BAM file%s...\n", nr_files,
(nr_files != 1 ? "s" : ""));
/* Check sanity of input */
if(dbschema != 0 && dbschema != 1) {
@@ -180,7 +180,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
if((msg = create_table_if_not_exists(cntxt, m, s, "pg", SQL_CREATE_PG,
"bam.create_pg", NULL)) != MAL_SUCCEED) goto cleanup;
/* Get next file id */
- TO_LOG("<bam_loader> Retrieving next file id...");
+ TO_LOG("#<bam_loader> Retrieving next file id...\n");
if((msg = next_file_id(m, files_table, &cur_file_id)) != MAL_SUCCEED) {
goto cleanup;
}
@@ -194,7 +194,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
memset(bws, 0, nr_files * sizeof(bam_wrapper)); /* Enables cleanup to
check which bam_wrappers to clear */
for(i=0; i<nr_files; ++i) {
- TO_LOG("<bam_loader> Initializing BAM wrapper for file '%s'...",
filenames[i]);
+ TO_LOG("#<bam_loader> Initializing BAM wrapper for file '%s'...\n",
filenames[i]);
if((msg = init_bam_wrapper(bws+i, filenames[i], cur_file_id++,
dbschema)) != MAL_SUCCEED) {
goto cleanup;
}
@@ -202,7 +202,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
/* Parse all headers */
for(i=0; i<nr_files; ++i) {
- TO_LOG("<bam_loader> Parsing BAM header for file '%s'...",
filenames[i]);
+ TO_LOG("#<bam_loader> Parsing BAM header for file '%s'...\n",
filenames[i]);
if((msg = process_bam_header(bws+i)) != MAL_SUCCEED) {
goto cleanup;
}
@@ -211,7 +211,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
/* If we have to load the BAM data into the pairwise storage schema, make
sure that all input BAM files are sorted on QNAME */
if(dbschema == 1) {
for(i=0; i<nr_files; ++i) {
- TO_LOG("<bam_loader> Checking sortedness for BAM file '%s'...",
filenames[i]);
+ TO_LOG("#<bam_loader> Checking sortedness for BAM file '%s'...\n",
filenames[i]);
if(bws[i].ord != ORDERING_QUERYNAME) {
msg = createException(MAL, "bam_loader", "Only BAM files that
are sorted on queryname can be inserted into the pairwise storage schema; "
"BAM file '%s' has ordering '%s'",
@@ -223,7 +223,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
/* Create alignment storage */
for(i=0; i<nr_files; ++i) {
- TO_LOG("<bam_loader> Creating alignment tables for BAM file '%s'...",
filenames[i]);
+ TO_LOG("#<bam_loader> Creating alignment tables for BAM file
'%s'...\n", filenames[i]);
if(
(dbschema == 0 && create_alignment_storage_0(cntxt,
"bam.create_storage_0", bws+i) != MAL_SUCCEED) ||
(dbschema == 1 && create_alignment_storage_1(cntxt,
"bam.create_storage_1", bws+i) != MAL_SUCCEED)) {
@@ -233,7 +233,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
/* Now create threads to read alignment data of different files */
- TO_LOG("<bam_loader> Creating reader threads...");
+ TO_LOG("#<bam_loader> Creating reader threads...\n");
if((reader_threads = (MT_Id *)GDKmalloc(nr_threads * sizeof(MT_Id))) ==
NULL) {
msg = createException(MAL, "bam_loader", MAL_MALLOC_FAIL);
goto cleanup;
@@ -251,7 +251,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
}
}
- TO_LOG("<bam_loader> Waiting for reader threads to finish...");
+ TO_LOG("#<bam_loader> Waiting for reader threads to finish...\n");
/* Wait until all threads finish and collect their messages. Though it is
not very likely, it could be the case that
* more than 1 thread generate an error message (not likely because
threads exit once they notice that another thread has failed).
* Therefore, we collect all error messages in one big error string
@@ -282,7 +282,7 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
goto cleanup;
}
- TO_LOG("<bam_loader> Copying data into DB...");
+ TO_LOG("#<bam_loader> Copying data into DB...\n");
/* All threads finished succesfully, copy all data into DB */\
for(i=0; i<nr_files; ++i) {
prepare_for_copy(bws+i);
@@ -302,10 +302,10 @@ cleanup:
if(r_thread_data) destroy_reader_thread_data(r_thread_data);
if(msg != MAL_SUCCEED) {
- TO_LOG("<bam_loader> Error on processing BAM files: %s", msg);
+ TO_LOG("#<bam_loader> Error on processing BAM files: %s\n", msg);
}
- TO_LOG("<bam_loader>: Loader finished processing %d BAM file%s...",
nr_files, (nr_files != 1 ? "s" : ""));
+ TO_LOG("#<bam_loader>: Loader finished processing %d BAM file%s...\n",
nr_files, (nr_files != 1 ? "s" : ""));
return msg;
}
diff --git a/sql/backends/monet5/bamloader/bam_wrapper.c
b/sql/backends/monet5/bamloader/bam_wrapper.c
--- a/sql/backends/monet5/bamloader/bam_wrapper.c
+++ b/sql/backends/monet5/bamloader/bam_wrapper.c
@@ -844,8 +844,8 @@ check_alignment_buffers(alignment *alig,
alig->qual = GDKrealloc(alig->qual, alig->seq_size * sizeof(char));
}
- if(resized[0]) TO_LOG("<bam_loader> Increased size of cigar buffer to %d
characters", alig->cigar_size);
- if(resized[1]) TO_LOG("<bam_loader> Increased size of seq and qual buffers
to %d characters", alig->seq_size);
+ if(resized[0]) TO_LOG("#<bam_loader> Increased size of cigar buffer to %d
characters\n", alig->cigar_size);
+ if(resized[1]) TO_LOG("#<bam_loader> Increased size of seq and qual
buffers to %d characters\n", alig->seq_size);
return (alig->cigar != NULL && alig->seq != NULL && alig->qual != NULL);
}
@@ -1299,7 +1299,7 @@ process_bam_alignments(bam_wrapper *bw,
}
}
nr_aligs = new_nr_aligs;
- TO_LOG("<bam_loader> Increased size of alignment buffer to
%d alignments", nr_aligs);
+ TO_LOG("#<bam_loader> Increased size of alignment buffer
to %d alignments\n", nr_aligs);
}
}
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list