func (task *Task) PostUnmarshalTask(cfg *config.Config,
	credentialsManager credentials.Manager, resourceFields *taskresource.ResourceFields,
	dockerClient dockerapi.DockerClient, ctx context.Context) error {
	// TODO, add rudimentary plugin support and call any plugins that want to
	// hook into this
	task.adjustForPlatform(cfg)
	if task.MemoryCPULimitsEnabled {
		err := task.initializeCgroupResourceSpec(cfg.CgroupPath, resourceFields)
		if err != nil {
			seelog.Errorf("Task [%s]: could not intialize resource: %v", task.Arn, err)
			return apierrors.NewResourceInitError(task.Arn, err)
		}
	}

	err := task.initializeContainerOrderingForVolumes()
	if err != nil {
		seelog.Errorf("Task [%s]: could not initialize volumes dependency for container: %v", task.Arn, err)
		return apierrors.NewResourceInitError(task.Arn, err)
	}

	err = task.initializeContainerOrderingForLinks()
	if err != nil {
		seelog.Errorf("Task [%s]: could not initialize links dependency for container: %v", task.Arn, err)
		return apierrors.NewResourceInitError(task.Arn, err)
	}

	if task.requiresASMDockerAuthData() {
		task.initializeASMAuthResource(credentialsManager, resourceFields)
	}

	if task.requiresSSMSecret() {
		task.initializeSSMSecretResource(credentialsManager, resourceFields)
	}

	if task.requiresASMSecret() {
		task.initializeASMSecretResource(credentialsManager, resourceFields)
	}

	err = task.initializeDockerLocalVolumes(dockerClient, ctx)
	if err != nil {
		return apierrors.NewResourceInitError(task.Arn, err)
	}
	err = task.initializeDockerVolumes(cfg.SharedVolumeMatchFullConfig, dockerClient, ctx)
	if err != nil {
		return apierrors.NewResourceInitError(task.Arn, err)
	}
	if cfg.GPUSupportEnabled {
		err = task.addGPUResource()
		if err != nil {
			seelog.Errorf("Task [%s]: could not initialize GPU associations: %v", task.Arn, err)
			return apierrors.NewResourceInitError(task.Arn, err)
		}
		task.NvidiaRuntime = cfg.NvidiaRuntime
	}
	task.initializeCredentialsEndpoint(credentialsManager)
	task.initializeContainersV3MetadataEndpoint(utils.NewDynamicUUIDProvider())
	err = task.addNetworkResourceProvisioningDependency(cfg)
	if err != nil {
		seelog.Errorf("Task [%s]: could not provision network resource: %v", task.Arn, err)
		return apierrors.NewResourceInitError(task.Arn, err)
	}
	// Adds necessary Pause containers for sharing PID or IPC namespaces
	task.addNamespaceSharingProvisioningDependency(cfg)

	return nil
}
func (task *Task) PostUnmarshalTask(cfg *config.Config,
	credentialsManager credentials.Manager, resourceFields *taskresource.ResourceFields,
	dockerClient dockerapi.DockerClient, ctx context.Context) error {
	
	
	task.adjustForPlatform(cfg)
	if task.MemoryCPULimitsEnabled {
		err := task.initializeCgroupResourceSpec(cfg.CgroupPath, resourceFields)
		if err != nil {
			seelog.Errorf("Task [%s]: could not intialize resource: %v", task.Arn, err)
			return apierrors.NewResourceInitError(task.Arn, err)
		}
	}

	err := task.initializeContainerOrderingForVolumes()
	if err != nil {
		seelog.Errorf("Task [%s]: could not initialize volumes dependency for container: %v", task.Arn, err)
		return apierrors.NewResourceInitError(task.Arn, err)
	}

	err = task.initializeContainerOrderingForLinks()
	if err != nil {
		seelog.Errorf("Task [%s]: could not initialize links dependency for container: %v", task.Arn, err)
		return apierrors.NewResourceInitError(task.Arn, err)
	}

	if task.requiresASMDockerAuthData() {
		task.initializeASMAuthResource(credentialsManager, resourceFields)
	}

	if task.requiresSSMSecret() {
		task.initializeSSMSecretResource(credentialsManager, resourceFields)
	}

	if task.requiresASMSecret() {
		task.initializeASMSecretResource(credentialsManager, resourceFields)
	}

	err = task.initializeDockerLocalVolumes(dockerClient, ctx)
	if err != nil {
		return apierrors.NewResourceInitError(task.Arn, err)
	}
	err = task.initializeDockerVolumes(cfg.SharedVolumeMatchFullConfig, dockerClient, ctx)
	if err != nil {
		return apierrors.NewResourceInitError(task.Arn, err)
	}
	if cfg.GPUSupportEnabled {
		err = task.addGPUResource()
		if err != nil {
			seelog.Errorf("Task [%s]: could not initialize GPU associations: %v", task.Arn, err)
			return apierrors.NewResourceInitError(task.Arn, err)
		}
		task.NvidiaRuntime = cfg.NvidiaRuntime
	}
	task.initializeCredentialsEndpoint(credentialsManager)
	task.initializeContainersV3MetadataEndpoint(utils.NewDynamicUUIDProvider())
	err = task.addNetworkResourceProvisioningDependency(cfg)
	if err != nil {
		seelog.Errorf("Task [%s]: could not provision network resource: %v", task.Arn, err)
		return apierrors.NewResourceInitError(task.Arn, err)
	}
	
	task.addNamespaceSharingProvisioningDependency(cfg)

	return nil
}
func ( task * Task ) PostUnmarshalTask ( cfg * config . Config , credentialsManager credentials . Manager , resourceFields * taskresource . ResourceFields , dockerClient dockerapi . DockerClient , ctx context . Context ) error { // TODO, add rudimentary plugin support and call any plugins that want to // hook into this task . adjustForPlatform ( cfg ) if task . MemoryCPULimitsEnabled { err := task . initializeCgroupResourceSpec ( cfg . CgroupPath , resourceFields ) if err != nil { seelog . Errorf ( " " , task . Arn , err ) return apierrors . NewResourceInitError ( task . Arn , err ) } } err := task . initializeContainerOrderingForVolumes ( ) if err != nil { seelog . Errorf ( " " , task . Arn , err ) return apierrors . NewResourceInitError ( task . Arn , err ) } err = task . initializeContainerOrderingForLinks ( ) if err != nil { seelog . Errorf ( " " , task . Arn , err ) return apierrors . NewResourceInitError ( task . Arn , err ) } if task . requiresASMDockerAuthData ( ) { task . initializeASMAuthResource ( credentialsManager , resourceFields ) } if task . requiresSSMSecret ( ) { task . initializeSSMSecretResource ( credentialsManager , resourceFields ) } if task . requiresASMSecret ( ) { task . initializeASMSecretResource ( credentialsManager , resourceFields ) } err = task . initializeDockerLocalVolumes ( dockerClient , ctx ) if err != nil { return apierrors . NewResourceInitError ( task . Arn , err ) } err = task . initializeDockerVolumes ( cfg . SharedVolumeMatchFullConfig , dockerClient , ctx ) if err != nil { return apierrors . NewResourceInitError ( task . Arn , err ) } if cfg . GPUSupportEnabled { err = task . addGPUResource ( ) if err != nil { seelog . Errorf ( " " , task . Arn , err ) return apierrors . NewResourceInitError ( task . Arn , err ) } task . NvidiaRuntime = cfg . NvidiaRuntime } task . initializeCredentialsEndpoint ( credentialsManager ) task . initializeContainersV3MetadataEndpoint ( utils . NewDynamicUUIDProvider ( ) ) err = task . addNetworkResourceProvisioningDependency ( cfg ) if err != nil { seelog . Errorf ( " " , task . Arn , err ) return apierrors . NewResourceInitError ( task . Arn , err ) } // Adds necessary Pause containers for sharing PID or IPC namespaces task . addNamespaceSharingProvisioningDependency ( cfg ) return nil }
// PostUnmarshalTask is run after a task has been unmarshalled, but before it has been
// run. It is possible it will be subsequently called after that and should be
// able to handle such an occurrence appropriately (e.g. behave idempotently).
PostUnmarshalTask is run after a task has been unmarshalled but before it has been run . It is possible it will be subsequently called after that and should be able to handle such an occurrence appropriately ( e . g . behave idempotently ) .