Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Bug 1179265 socorroanalysis cron jobs #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jdotpz
Copy link
Contributor

@jdotpz jdotpz commented Jul 31, 2015

This is to resolve bug 1179265. It adds a few cronjobs to the analysis server.

@jdotpz jdotpz changed the title [DO NOT MERGE YET] Bug 1179265 cron jobs Bug 1179265 cron jobs Jul 31, 2015
Move cron jobs to analysis server

Fix styling

Fix styling
05 00 * * * socorro /usr/bin/envconsul -once -prefix socorro/common -upcase -sanitize /data/bin/cron_libraries.sh >> /var/log/socorro/cron_libraries.log 2>&1

# Missing symbols report
00 17 * * * socorro /usr/bin/envconsul -once -prefix socorro/common -upcase -sanitize /data/bin/cron_missing_symbols.sh >> /var/log/socorro/missing_symbols.log 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing a job here:

# Daily CSV report for crash-analysis
55 03 * * * socorro /data/bin/cron_daily_reports.sh >> /var/log/socorro/cron_daily_reports.log 2>&1

@rhelmer
Copy link
Contributor

rhelmer commented Aug 13, 2015

Ugh, also my bad - I missed one of the /data/bin scripts.

There should be a /data/bin/tar_crashes.py:

#!/usr/bin/env python
"""
This takes the output of PostgreSQL's JSON crashes as stdin
and stores them as a tar file that correlations reports expect.
"""

import gzip
import sys
import tarfile
import cStringIO

def main():
    if len(sys.argv) != 2:
        print 'syntax: ./tar_crashes.py <filename>'
        sys.exit(1)

    output_file = sys.argv[1]

    tar = tarfile.open('%s' % output_file, 'a')
    for line in sys.stdin:
        crash_id, processed_crash = line.split('\x02')
        compressed_crash = cStringIO.StringIO()
        gzip_file = gzip.GzipFile(fileobj=compressed_crash, mode='w')
        gzip_file.write(processed_crash)
        gzip_file.close()
        compressed_crash.seek(0)
        tarinfo = tarfile.TarInfo('%s.jsonz' % crash_id)
        tarinfo.size = len(compressed_crash.getvalue())
        tar.addfile(tarinfo, compressed_crash) 
    tar.close()

if __name__ == '__main__':
    main()

@rhelmer rhelmer changed the title Bug 1179265 cron jobs Bug 1179265 socorroanalysis cron jobs Aug 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants