Question

after playing a bit an uploading some small test files I wanted to upload a bigger file, around 200 MB but I always get the timeout exception, then I tried to upload a 30 MB file and the same happens. I think the timeout is 30 seconds, it is possible to tell the glacier client to wait until the upload is done?

This is the code I use:

$glacier->uploadArchive(array(
            'vaultName'          => $vaultName,
            'archiveDescription' => $desc
            'body'               => $body
        ));

I have tested with other files and the same happens, then I tried with a small file of 4MB and the operation was successful, I thought that dividing the files and uploading them one by one, bu then again around the third one a timeout exception comes out.

I also tried the multiupload with the following code

$glacier = GlacierClient::factory(array(
            'key'    => 'key',
            'secret' => 'secret',
            'region' => Region::US_WEST_2
        ));

$multiupload = $glacier->initiateMultipartUpload(array(
    'vaultName' => 'vaultName',
    'partSize' => '4194304'
));

// An array for the suffixes of the tar file
foreach($suffixes as $suffix){
$contents = file_get_contents('file.tar.gz'.$suffix);
$glacier->uploadMultipartPart(array(
    'vaultName' => 'vaultName',
    'uploadId' => $multiupload->get('uploadId'),
    'body' => $contents
));
}


$result=$glacier->completeMultipartUpload(array(
    'vaultName' => 'vaultName',
    'uploadId' => $multiupload->get('uploadId'),
));

echo $result->get('archiveId');

It misses the parameter Range, I don't think I fully understand how this multi part upload works, but I think I will have the same timeout exception. So my question is as I said before. It is possible to tell the glacier client to wait until the upload is done?

Was it helpful?

Solution 2

This sounds suspiciously like a script timeout. Try

set_time_limit (120);

just inside of the foreach loop. This will give you a two minute PHP sanity timer for each of your multi-part files.

OTHER TIPS

The timeout sounds like a script timeout like Jimzie said.

As for using the Glacier client, you should checkout this blog post from the official AWS PHP Developer Blog, which shows how to do multipart uploads to Glacier using the UploadPartGenerator object. If you are doing the part uploads in different requests/processes, you should also keep in mind that the UploadPartGenerator class can be serialized.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top