Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)
Writes information about components that were successfully uploaded so
that the upload can be resumed at a later date. The tracker file has
the format:
  random_prefix
  temp_object_1_name
  temp_object_1_generation
  .
  .
  .
  temp_object_N_name(more...)

        def _CreateParallelUploadTrackerFile(tracker_file, random_prefix, components,
                                     tracker_file_lock):
  """Writes information about components that were successfully uploaded so
     that the upload can be resumed at a later date. The tracker file has
     the format:
       random_prefix
       temp_object_1_name
       temp_object_1_generation
       .
       .
       .
       temp_object_N_name
       temp_object_N_generation
     where N is the number of components that have been successfully uploaded.

     Args:
       tracker_file: The name of the parallel upload tracker file.
       random_prefix: The randomly-generated prefix that was used for
                      for uploading any existing components.
       components: A list of ObjectFromTracker objects that were uploaded.
  """
  lines = [random_prefix]
  lines += _GetParallelUploadTrackerFileLinesForComponents(components)
  lines = [line + '\n' for line in lines]
  with tracker_file_lock:
    open(tracker_file, 'w').close()  # Clear the file.
    with open(tracker_file, 'w') as f:
      f.writelines(lines)
        


src/g/s/gsutil-3.42/gslib/tests/test_cp_funcs.py   gsutil(Download)
from gslib.commands.cp import _HashFilename
from gslib.commands.cp import _ParseParallelUploadTrackerFile
from gslib.commands.cp import _CreateParallelUploadTrackerFile
from gslib.commands.cp import ObjectFromTracker
from gslib.tests.testcase.unit_testcase import GsUtilUnitTestCase
    objects = [ObjectFromTracker(objects[2 * i], objects[2 * i + 1])
                       for i in range(0, len(objects) / 2)]
    _CreateParallelUploadTrackerFile(tracker_file, random_prefix, objects,
                                     tracker_file_lock)
    with open(tracker_file, 'rb') as f:
    objects = [ObjectFromTracker(objects[2 * i], objects[2 * i + 1])
                       for i in range(0, len(objects) / 2)]
    _CreateParallelUploadTrackerFile(tracker_file, random_prefix, objects,
                                     tracker_file_lock)
 

src/g/s/gsutil-HEAD/gslib/tests/test_cp_funcs.py   gsutil(Download)
from gslib.commands.cp import _HashFilename
from gslib.commands.cp import _ParseParallelUploadTrackerFile
from gslib.commands.cp import _CreateParallelUploadTrackerFile
from gslib.commands.cp import ObjectFromTracker
from gslib.tests.testcase.unit_testcase import GsUtilUnitTestCase
    objects = [ObjectFromTracker(objects[2 * i], objects[2 * i + 1])
                       for i in range(0, len(objects) / 2)]
    _CreateParallelUploadTrackerFile(tracker_file, random_prefix, objects,
                                     tracker_file_lock)
    with open(tracker_file, 'rb') as f:
    objects = [ObjectFromTracker(objects[2 * i], objects[2 * i + 1])
                       for i in range(0, len(objects) / 2)]
    _CreateParallelUploadTrackerFile(tracker_file, random_prefix, objects,
                                     tracker_file_lock)