def download_udocker_image(self): self.save_tmp_udocker_env() SysUtils.execute_command_with_msg( self.udocker_exec + ["pull", self.aws.lambdaf.image], cli_msg="Downloading container image") self._create_udocker_container() self._set_udocker_local_registry() self.restore_udocker_env()
def _validate_container_size(self, max_payload_size): if FileUtils.get_tree_size(self.udocker_dir) < (max_payload_size / 2): ucmd = self.udocker_exec + [ "create", "--name=lambda_cont", self.aws.lambdaf.image ] SysUtils.execute_command_with_msg( ucmd, cli_msg="Creating container structure") elif FileUtils.get_tree_size(self.udocker_dir) > max_payload_size: FileUtils.delete_folder( FileUtils.join_paths(self.udocker_dir, "containers")) else: self.aws.lambdaf.environment['Variables']['UDOCKER_LAYERS'] = \ '/var/task/udocker/containers/'
def prepare_udocker_image(self): self._save_tmp_udocker_env() cmd_out = SysUtils.execute_command_with_msg(self._udocker_exec + ["load", "-i", self.resources_info.get('lambda').get('container').get('image_file')], cli_msg="Loading image file") # Get the image name from the command output self.resources_info['lambda']['container']['image'] = cmd_out.split('\n')[1] self._set_udocker_local_registry() self._restore_udocker_env()
def prepare_udocker_image(self): self.save_tmp_udocker_env() image_path = FileUtils.join_paths(FileUtils.get_tmp_dir(), "udocker_image.tar.gz") FileUtils.copy_file(self.aws.lambdaf.image_file, image_path) cmd_out = SysUtils.execute_command_with_msg( self.udocker_exec + ["load", "-i", image_path], cli_msg="Loading image file") # Get the image name from the command output self.aws.lambdaf.image = cmd_out.split('\n')[1] self._create_udocker_container() self.aws.lambdaf.environment['Variables'][ 'IMAGE_ID'] = self.aws.lambdaf.image self._set_udocker_local_registry() self.restore_udocker_env()