Esempio n. 1
0
/* connector for BOLD Systems -- species-level taxa
estimated execution time 1.5 | 7.2 hours
Partner provides XML service and a big XML file.
No need to run multiple connectors anymore since we got the big XML file.
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
$timestart = time_elapsed();
$resource_id = 212;
/* utility Functions::count_rows_from_text_file(DOC_ROOT . "temp/media_resource.tab"); */
$folder = DOC_ROOT . "update_resources/connectors/files/BOLD";
if (!file_exists($folder)) {
    mkdir($folder, 0777);
}
require_library('connectors/BOLDSysAPI');
$bolds = new BOLDSysAPI();
// /* This will store DNA sequence on a json file, un-comment if u want this re-created everytime you run 212.php. Will last around 57 mins. excluding the time downloading the big dump file from BOLDS
$bolds->save_dna_sequence_from_big_xml();
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
echo "\n elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours";
echo "\n Done save_dna_sequence_from_big_xml() \n\n";
// */
$bolds->initialize_text_files();
// not commented on regular operation. If running multiple connectors, the first connector will pass here and succeeding ones won't.
require_library('connectors/BOLDSysArchiveAPI');
$func = new BOLDSysArchiveAPI($resource_id);
$func->start_process($resource_id, false);
Functions::finalize_dwca_resource($resource_id);
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
Esempio n. 2
0
<?php

namespace php_active_record;

/* connector for BOLD Systems
This script is called if the main script calls for another instance of the connector.
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
$timestart = time_elapsed();
require_library('connectors/BOLDSysAPI');
$resource_id = 212;
if (isset($argv[1])) {
    $call_multiple_instance = false;
} else {
    $call_multiple_instance = true;
}
$bolds = new BOLDSysAPI();
$bolds->start_process($resource_id, $call_multiple_instance);
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n";
echo "elapsed time = " . $elapsed_time_sec / 60 . " minutes   \n";
echo "elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours \n";
echo "\n\n Done processing.";
Esempio n. 3
0
namespace php_active_record;

/* connector for BOLD Systems -- species-level taxa
estimated execution time 1.5 | 7.2 hours
Partner provides XML service and a big XML file.
No need to run multiple connectors anymore since we got the big XML file.
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
$timestart = time_elapsed();
require_library('connectors/BOLDSysAPI');
$resource_id = 212;
$folder = DOC_ROOT . "update_resources/connectors/files/BOLD";
if (!file_exists($folder)) {
    mkdir($folder, 0777);
}
$bolds = new BOLDSysAPI();
// /* This will store DNA sequence on a json file, un-comment if u want this re-created everytime you run 212.php. Will last around 57 mins. excluding the time downloading the big dump file from BOLDS
$bolds->save_dna_sequence_from_big_xml();
$elapsed_time_sec = time_elapsed() - $timestart;
echo "\n\n elapsed time = " . $elapsed_time_sec / 60 . " minutes";
echo "\n elapsed time = " . $elapsed_time_sec / 60 / 60 . " hours";
echo "\n Done save_dna_sequence_from_big_xml() \n\n";
// */
$bolds->initialize_text_files();
// not commented on regular operation. If running multiple connectors, the first connector will pass here and succeeding ones won't.
$bolds->start_process($resource_id, false);
if (filesize(CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml") > 1000) {
    Functions::set_resource_status_to_force_harvest($resource_id);
    $command_line = "gzip -c " . CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml >" . CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml.gz";
    $output = shell_exec($command_line);
}