Commit 47517cdf authored by Kevin Harms's avatar Kevin Harms

Minor fixes for log conversion script.


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@446 3b7491f3-a168-0410-bf4b-c445ed680a29
parent f69244ff
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# #
my $darshan_convert = "./darshan-convert"; my $darshan_convert = "./darshan-convert";
my $jenkins = "./jenkins";
sub load_annotations($$) sub load_annotations($$)
{ {
...@@ -59,11 +60,23 @@ sub main() ...@@ -59,11 +60,23 @@ sub main()
my $annotation; my $annotation;
my $hashed_fname; my $hashed_fname;
my @args; my @args;
my $year;
my $month;
my $day;
my $logname;
my $rc;
$jobid = $1; $jobid = $1;
$annotation = $ref->{$jobid}; $annotation = $ref->{$jobid};
$hashed_fname = `./jenkins --64 --key $hash_key $logfile`; if ($logfile =~ /\/(\d+)\/(\d+)\/(\d+)\/([0-9a-zA-Z\-_\.]+)/)
{
$year = $1;
$month = $2;
$day = $3;
$logname = $4;
}
$hashed_fname = `$jenkins --64 --key $hash_key $logname`;
chomp($hashed_fname); chomp($hashed_fname);
@args = ("$darshan_convert", @args = ("$darshan_convert",
...@@ -71,9 +84,14 @@ sub main() ...@@ -71,9 +84,14 @@ sub main()
"--key=$hash_key", "--key=$hash_key",
"--annotate=$annotation", "--annotate=$annotation",
"$logfile", "$logfile",
"$output_path/$hashed_fname.gz"); "$output_path/$year/$month/$day/$hashed_fname.bz2");
system(@args); $rc = system(@args);
print("$hashed_fname\t$logfile\n"); if ($rc) {
print("$hashed_fname\t$logfile:failed:$rc\n");
}
else {
print("$hashed_fname\t$logfile\n");
}
} }
else else
{ {
......
...@@ -157,7 +157,9 @@ int main(int argc, char **argv) ...@@ -157,7 +157,9 @@ int main(int argc, char **argv)
infile = darshan_log_open(infile_name, "r"); infile = darshan_log_open(infile_name, "r");
if(!infile) if(!infile)
{ {
perror("darshan_log_open"); char errmsg[256];
sprintf(errmsg, "darshan_log_open: %s", infile_name);
perror(errmsg);
return(-1); return(-1);
} }
...@@ -167,7 +169,9 @@ int main(int argc, char **argv) ...@@ -167,7 +169,9 @@ int main(int argc, char **argv)
outfile = darshan_log_open(outfile_name, "w"); outfile = darshan_log_open(outfile_name, "w");
if(!outfile) if(!outfile)
{ {
perror("darshan_log_open"); char errmsg[256];
sprintf(errmsg, "darshan_log_open: %s", outfile_name);
perror(errmsg);
return(-1); return(-1);
} }
...@@ -238,8 +242,7 @@ int main(int argc, char **argv) ...@@ -238,8 +242,7 @@ int main(int argc, char **argv)
} }
if(ret == 0) if(ret == 0)
{ {
darshan_log_close(infile); goto done;
darshan_log_close(outfile);
} }
do do
...@@ -269,6 +272,7 @@ int main(int argc, char **argv) ...@@ -269,6 +272,7 @@ int main(int argc, char **argv)
fflush(stderr); fflush(stderr);
} }
done:
for(i=0; i<mount_count; i++) for(i=0; i<mount_count; i++)
{ {
free(mnt_pts[i]); free(mnt_pts[i]);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* See COPYRIGHT in top-level directory. * See COPYRIGHT in top-level directory.
*/ */
#define _GNU_SOURCE
#include "darshan-config.h" #include "darshan-config.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -259,7 +260,7 @@ darshan_fd darshan_log_open(const char *name, const char* mode) ...@@ -259,7 +260,7 @@ darshan_fd darshan_log_open(const char *name, const char* mode)
* in order to get a chance to try both compression formats. * in order to get a chance to try both compression formats.
*/ */
test_fd = open(name, O_RDONLY); test_fd = open(name, O_RDONLY);
if(!test_fd) if(test_fd < 0)
{ {
perror("open"); perror("open");
free(tmp_fd->name); free(tmp_fd->name);
...@@ -583,7 +584,14 @@ int darshan_log_putmounts(darshan_fd fd, int64_t* devs, char** mnt_pts, char** f ...@@ -583,7 +584,14 @@ int darshan_log_putmounts(darshan_fd fd, int64_t* devs, char** mnt_pts, char** f
return(-1); return(-1);
} }
} }
/* seek ahead to end of exe region, will be zero filled */
ret = darshan_log_seek(fd, CP_JOB_RECORD_SIZE);
if (ret)
{
fprintf(stderr, "Error: forward seek failed: %d\n", CP_JOB_RECORD_SIZE);
}
return(0); return(0);
} }
...@@ -1354,7 +1362,7 @@ static int darshan_log_write(darshan_fd fd, void* buf, int len) ...@@ -1354,7 +1362,7 @@ static int darshan_log_write(darshan_fd fd, void* buf, int len)
if(fd->gzf) if(fd->gzf)
{ {
ret = gzwrite(fd, buf, len); ret = gzwrite(fd->gzf, buf, len);
if(ret > 0) if(ret > 0)
fd->pos += ret; fd->pos += ret;
return(ret); return(ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment