def load_artifacts(self, queue_service):
    if (self.state not in self.valid_states):
        logger.warn('Invalid task state', state=self.state, id=self.id, name=self.name)
        return
    out = {}
    for artifact_name in self.artifacts:
        logger.info('Load artifact', task_id=self.id, artifact=artifact_name)
        try:
            artifact = queue_service.getArtifact(self.id, self.run_id, artifact_name)
            out[artifact_name] = ((('response' in artifact) and artifact['response'].content) or artifact)
        except Exception as e:
            logger.warn('Failed to read artifact', task_id=self.id, run_id=self.run_id, artifact=artifact_name, error=e)
            continue
    return out
def load_artifacts(self, queue_service):
    if (self.state not in self.valid_states):
        logger.warn('Invalid task state', state=self.state, id=self.id, name=self.name)
        return
    out = {}
    for artifact_name in self.artifacts:
        logger.info('Load artifact', task_id=self.id, artifact=artifact_name)
        try:
            artifact = queue_service.getArtifact(self.id, self.run_id, artifact_name)
            out[artifact_name] = ((('response' in artifact) and artifact['response'].content) or artifact)
        except Exception as e:
            logger.warn('Failed to read artifact', task_id=self.id, run_id=self.run_id, artifact=artifact_name, error=e)
            continue
    return out