tripleo-common/tripleo_common/utils
Bogdan Dobrelya 46f8129894 Make upload workers faster on processing layers
Make upload workers processing image layers only once (as the best
effort). This also reworks and simplifies locks management for
individual tasks now managed for the PythonImageUploader class
namespace only.

When fetching source layer, cross-link it for the target
local image, whenever that source is already exists. When pushing a
layer to a target registry, do not repeat transfering the same data,
if already pushed earlier for another image.

The 1st time a layer gets uploaded/fetched for an image, that image and
its known path (local or remote) becomes a reference for future
cross-referencing by other images.

Store such information about already processed layers in global view
shared for all workers to speed-up data transfering jobs they execute.

Having that global view, uploading the 1st image in the tasks list as a
separate (and non-concurrent) job becomes redundant and now will be
executed concurently with other images.

Based on the dynamically picked multi-workers mode, provide the global
view as a graf with its MP/MT state synchronization as the following:

* use globally shared locking info also containing global layers view
  for MP-workers. With the shared global view state we can no longer
  use local locking objects individual for each task.
* if cannot use multi-process workers, like when executing it via
  Mistral by monkey patched eventlet greenthreads, choose threadinglock
  and multi-threads-safe standard dictionary in the shared class
  namespace to store the global view there
* if it can do MP, pick processlock also containing a safe from data
  races Manager().dict() as the global view shared among cooperating OS
  processes.
* use that global view in a transparent fashion, provided by a special
  classmethod proxying access to the internal state shared for workers.

Ultimately, all that optimizes:

* completion time
* re-fetching of the already processed layers
* local deduplication of layers
* the amount of outbound HTTP requests to registries
* if-layer-exists and other internal logic check executed against the
  in-memory cache firstly.

As layers locking and unlocking becomes a popular action, reduce the
noise of the debug messages it produces.

Closes-bug: #1847225
Related-bug: #1844446

Change-Id: Ie5ef4045b7e22c06551e886f9f9b6f22c8d4bd21
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
2019-11-07 17:01:32 +01:00
..
locks Make upload workers faster on processing layers 2019-11-07 17:01:32 +01:00
__init__.py Initial workflow implementation of tripleo-common 2015-12-07 12:38:42 -05:00
clouds_yaml.py Added support of overcloud os_cloud 2019-07-11 16:08:34 +05:30
common.py Image Uploader - get_undercloud_registry IPv6 2019-07-10 15:02:31 +02:00
config.py Warn when looking up grandparent resource name 2019-09-17 12:43:58 -04:00
glance.py create_or_find_kernel_and_ramdisk docstring fixes 2019-09-04 14:19:41 -04:00
image.py Make upload workers faster on processing layers 2019-11-07 17:01:32 +01:00
keystone.py nova-less-deploy: deploy_instances and undeploy_instances workflows 2019-01-16 12:41:42 +01:00
nodes.py Remove support for enrolling nodes with Cisco hardware types 2019-08-05 20:15:56 +02:00
overcloudrc.py Add OS_COMPUTE_API_VERSION to overcloudrc 2019-10-07 11:07:51 +02:00
parameters.py Add convert_docker_params function 2019-04-10 10:02:53 -04:00
passwords.py Ensure that OctaviaServerCertsKeyPassphrase is 32-byte long 2019-07-04 00:03:44 +03:00
plan.py Handle secret strings correctly 2019-03-01 22:46:05 +00:00
process.py Fix bashate and flake8 errors 2019-06-14 19:23:53 +01:00
roles.py Remove disable_constraints 2019-08-15 21:52:07 +00:00
safe_import.py Make gitpython and eventlet work with eventlet 0.25.1 2019-10-03 10:03:45 +00:00
swift.py utils/swift/download_container: python3 adjustment 2019-03-08 10:56:40 -07:00
tarball.py Open tarball in binary mode 2018-08-21 16:16:57 -06:00
time_functions.py Add GUI logging workflows 2017-08-08 08:55:55 +02:00
validations.py Processing available Ansible variables as 'parameters' not as 'metadata' 2019-07-08 13:02:31 +02:00