def __init__(self, *args, **kwargs):
        '''
        When a new instance of the DockerTask class gets created:
        - call the parent class __init__ method
        - start the logger
        - init an instance of the docker client
        - create a tmp dir
        - add the temp dir to the volume binds specified in the task
        '''
        super(DockerTask, self).__init__(*args, **kwargs)
        self.__logger = logger

        '''init docker client
        using the low level API as the higher level API does not allow to mount single
        files as volumes
        '''
        self._client = docker.APIClient(self.docker_url)

        # add latest tag if nothing else is specified by task
        if ':' not in self.image:
            self._image = ':'.join([self.image, 'latest'])
        else:
            self._image = self.image

        if self.mount_tmp:
            # create a tmp_dir, NOTE: /tmp needs to be specified for it to work on
            # macOS, despite what the python documentation says
            self._host_tmp_dir = mkdtemp(suffix=self.task_id,
                                         prefix='luigi-docker-tmp-dir-',
                                         dir='/tmp')

            self._binds = ['{0}:{1}'.format(self._host_tmp_dir, self.container_tmp_dir)]
        else:
            self._binds = []

        # update environment property with the (internal) location of tmp_dir
        self.environment['LUIGI_TMP_DIR'] = self.container_tmp_dir

        # add additional volume binds specified by the user to the tmp_Dir bind
        if isinstance(self.binds, six.string_types):
            self._binds.append(self.binds)
        elif isinstance(self.binds, list):
            self._binds.extend(self.binds)

        # derive volumes (ie. list of container destination paths) from
        # specified binds
        self._volumes = [b.split(':')[1] for b in self._binds]
def __init__ ( self , * args , ** kwargs ) : super ( DockerTask , self ) . __init__ ( * args , ** kwargs ) self . __logger = logger '''init docker client
        using the low level API as the higher level API does not allow to mount single
        files as volumes
        ''' self . _client = docker . APIClient ( self . docker_url ) if ':' not in self . image : self . _image = ':' . join ( [ self . image , 'latest' ] ) else : self . _image = self . image if self . mount_tmp : self . _host_tmp_dir = mkdtemp ( suffix = self . task_id , prefix = 'luigi-docker-tmp-dir-' , dir = '/tmp' ) self . _binds = [ '{0}:{1}' . format ( self . _host_tmp_dir , self . container_tmp_dir ) ] else : self . _binds = [ ] self . environment [ 'LUIGI_TMP_DIR' ] = self . container_tmp_dir if isinstance ( self . binds , six . string_types ) : self . _binds . append ( self . binds ) elif isinstance ( self . binds , list ) : self . _binds . extend ( self . binds ) self . _volumes = [ b . split ( ':' ) [ 1 ] for b in self . _binds ]
When a new instance of the DockerTask class gets created:
        - call the parent class __init__ method
        - start the logger
        - init an instance of the docker client
        - create a tmp dir
        - add the temp dir to the volume binds specified in the task