Atom - Bulk Generate PDF Finding Aids
Process
Notes: Your gearman worker may quit during this process. Restart the worker and it will automatically resume.
Code
generateListOfObjects.php
<?php
$c = new Criteria;
$c->add(QubitInformationObject::PARENT_ID, 1);
$file = fopen("processFindingAids.txt", "w");
foreach (QubitInformationObject::get($c) as $io)
{
if ($io->getPublicationStatus()->statusId == QubitTerm::PUBLICATION_STATUS_DRAFT_ID)
continue;
$txt = $io->id . ",Generating finding aid for: ".$io->getTitle(array("cultureFallback" => true)). "\n";
fwrite($file,$txt);
}
fclose($file);
?>
genFindingAidsFromList.php
<?php
$myfile = fopen("processFindingAids.txt", "r") or die("Unable to open file!");
while(!feof($myfile)) {
$line = fgets($myfile);
$var = explode(",",$line);
print $var[1] . "\n";
$params = array(
'objectId' => $var[0],
'description' => trim($var[1])
);
$job = QubitJob::runJob('arGenerateFindingAidJob', $params,'AtoM instance key');
sleep(30);
}
?>
AtoM - Generate Large PDF Finding Aids from Command Line
This is useful if your PDF is too large to be generated using symfony and gearman.
Process
STEP 1:
<path_to_your_php>php -d memory_limit=-1 -d error_reporting="E_ALL" symfony export:bulk --single-slug=<top-level description slug> --public <location_to_save file> 2>&1
Example:
<path_to_your_php>php -d memory_limit=-1 -d error_reporting="E_ALL" symfony export:bulk --single-slug=dalhousie-university-reference-collection --public /temp 2>&1
STEP 2:
java -jar '<path_to_atom>/lib/task/pdf/saxon9he.jar' -s:'<full_path_to_file_including_name>' -xsl:'<path_to_atom>/lib/task/pdf/ead-pdf-<template_type>.xsl' -o:'<full_path_to_new_file_including_name>' 2>&1
Example:
java -jar '/appl/www/html/atom-2.3.0/lib/task/pdf/saxon9he.jar' -s:'/temp/ead_0000049278_dalhousie-university-reference-collection.xml' -xsl:'/appl/www/html/atom-2.3.0/lib/task/pdf/ead-pdf-full-details.xsl' -o:'/temp/ead_0000049278_dalhousie-university-reference-collection.fo' 2>&1
STEP 3:
fop -r -q -fo '<full_path_to_fo_file_including_name>' -pdf '<full_path_to_new_file_including_name>.pdf' 2>&1
Example:
fop -r -q -fo '/temp/ead_0000049278_dalhousie-university-reference-collection.fo' -pdf '/temp/dalhousie-university-reference-collection.pdf' 2>&1
--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/CAHueW_WYY9u9up6DiLQcf2cSqigqAAd%3DxPVsQmdY3HQAfPv2wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/443f7a29-3089-4fa8-8232-b25f0b696cd3%40googlegroups.com.
For anyone else following along here, there is one caveat to the steps to generate PDFs for large finding aids via the command line: EAD exported via command will include elements that are marked as hidden in the visible elements module. If you use the visible elements module to mask certain elements, then you must remove these elements from EAD exported via command before processing the EAD with your XSLT.
To post to this group, send email to ica-atom-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/CAHueW_VH90o5X0_FoEmisfxt5weYtvpPpkE67kUW55ZXVo-TLA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/CAHueW_VH90o5X0_FoEmisfxt5weYtvpPpkE67kUW55ZXVo-TLA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/CAC1FhZJdYWmJbC0LzWBsmPonmixkwFcsCdE%2BLQtBDNO_A2Jamg%40mail.gmail.com.
My pleasure, Vicky! Our developer Margaret Vail worked all of this out, so I might have to confirm with her, but I think she "found" the key by manually generating a finding aid via the browser and then checking the logs. Our key was a 32 character string. Have you tried that? Maybe someone knows of an easier method?Remember that it is a good idea to clear all of the previously generated finding aids before running the scripts.
For anyone else following along here, there is one caveat to the steps to generate PDFs for large finding aids via the command line: EAD exported via command will include elements that are marked as hidden in the visible elements module. If you use the visible elements module to mask certain elements, then you must remove these elements from EAD exported via command before processing the EAD with your XSLT.
I'm not sure if there is some way to mask certain elements when EAD is exported via command, but you can easily remove the elements from the EAD in Oxygen and then continue on to the other steps.
Cheers,
Creighton
On 6 April 2017 at 19:07, 'Vicky Phillips' via AtoM Users <ica-ato...@googlegroups.com> wrote:
Yes thanks for sharing this Creighton. I'm trying to give this a go at the moment. I've managed to generate the list but struggling to find the key for our installation in order to do the next part. Can anyone tell me what file I can look at in order to get the key please?
Thanks
Vicky
--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
Hi CreightonI was looking at genFindingAidsFromList.php, and in particular the key that is used - this can be simplified so that the key does not need to be found and passed in.The key is used to ensure that the gearman worker process associates a given job with the correct AtoM instance which is important when multiple AtoM instances are hosted on a single server. The key is actually a hash of the strings for SiteTitle + Site Base Url + Site Root Dir and is normally calculated on the fly from AtoM Settings when a job is submitted via the Web Interface.We can simplify genFindingAidsFromList.php so that it has the context it requires so that QubitJob::runJob can generate this key automatically - see my changes in bold below:
<?php
// Grab the settings for use here
$context = sfContext::getInstance();sfConfig::add(QubitSetting::getSettingsArray()); // Important!
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/d5308840-e004-4ae4-bc96-aea21d544866%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/25857b73-69f7-40b4-880f-2796817e8dbc%40googlegroups.com.
Generating finding aid for: Aston Hall Estate Records
Exporting EAD has failed.
ERROR(EAD-EXPORT): PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 23221523 bytes) in /var/www/atom-2.3.0/lib/task/export/exportBulkTask.class.php on line 115
We've increased the memory and a couple have gone through but the rest remain in the queue. How can I get rid of these from the queue? I didn't want to be generating Finding Aids in the day while the archivists are working on the site otherwise anything that they do that requires the job scheduler will be added to the end of my long queue of PDF generation tasks.
We're still looking into how we can produce these on our test instance and copy them across to the live site. I was hoping that it would be a simple copy across from one server to another but it doesn't look that way at the moment. We'd be grateful of any suggestions as to how to go about this.
Thanks,
Vicky