1234567891011121314151617181920212223242526272829 |
- def generate_csa(result_pk, monitor_pk=None):
- result = models.Results.objects.get(pk=result_pk)
- report_dir = result.get_report_dir()
- raw_data_dir = result.experiment.expDir
- try:
- monitor = models.FileMonitor.objects.get(pk=monitor_pk)
- except models.FileMonitor.DoesNotExist:
- monitor = models.FileMonitor()
- monitor.tags = "generate_csa"
- csa_file_name = "csa_{0:04d}.zip".format(int(result_pk))
- monitor.status = "Generating"
- monitor.local_dir = report_dir
- monitor.name = csa_file_name
- monitor.save()
- # Generate report PDF file.
- # This will create a file named report.pdf in results directory
- makePDF.write_report_pdf(result_pk)
- csa_path = makeCSA.makeCSA(report_dir, raw_data_dir, monitor.name)
- digest_hex, digest_64, size = md5_stats_file(csa_path)
- monitor.md5sum = digest_hex
- monitor.size = size
- monitor.status = "Generated"
- monitor.save()
|