'Process any retrieved artifacts.'

@flow.StateHandler()
def ProcessBase(self, responses):

    artifact_name = responses.request_data['artifact_name']
    self.state.in_flight_artifacts.remove(artifact_name)
    self.state.completed_artifacts.append(artifact_name)
    if (not responses.success):
        self.Log('Failed    to    get    artifact    %s.    Status:    %s', artifact_name, responses.status)
    else:
        deps = self.SetKBValue(responses.request_data['artifact_name'], responses)
        if deps:
            for dep in deps:
                required_artifacts = artifact_registry.REGISTRY.GetArtifactNames(os_name=self.state.knowledge_base.os, provides=[dep])
                if required_artifacts.issubset(self.state.completed_artifacts):
                    self.state.fulfilled_deps.append(dep)
                else:
                    self.state.partial_fulfilled_deps.add(dep)
        else:
            self.Log('Failed    to    get    artifact    %s.    Artifact    failed    to    return    value.', artifact_name)
    if self.state.awaiting_deps_artifacts:
        self._ScheduleCollection()
        if (self.state.awaiting_deps_artifacts and (not self.state.in_flight_artifacts)):
            missing_deps = list(self.state.all_deps.difference(self.state['fulfilled_deps']))
            if self.args.require_complete:
                raise flow.FlowError(('KnowledgeBase    initialization    failed    as    the    following    artifacts    had    dependencies    that    could    not    be    fulfilled    %s.    Missing:    %s' % (self.state.awaiting_deps_artifacts, missing_deps)))
            else:
                self.Log(('Storing    incomplete    KnowledgeBase.    The    following    artifacts    had    dependencies    that    could    not    be    fulfilled    %s.    Missing:    %s.    Completed:    %s' % (self.state.awaiting_deps_artifacts, missing_deps, self.state.completed_artifacts)))
