@classmethod<EOL><INDENT>def from_yaml(cls, yaml_string):<DEDENT>
try:<EOL><INDENT>job = yaml.full_load(yaml_string)<EOL><DEDENT>except AttributeError:<EOL><INDENT>job = yaml.load(yaml_string)<EOL><DEDENT>dsub_version = job.get('<STR_LIT>')<EOL>if not dsub_version:<EOL><INDENT>return cls._from_yaml_v0(job)<EOL><DEDENT>job_metadata = {}<EOL>for key in [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>'<EOL>]:<EOL><INDENT>if job.get(key) is not None:<EOL><INDENT>job_metadata[key] = job.get(key)<EOL><DEDENT><DEDENT>job_metadata['<STR_LIT>'] = dsub_util.replace_timezone(<EOL>job.get('<STR_LIT>'), pytz.utc)<EOL>job_resources = Resources(logging=job.get('<STR_LIT>'))<EOL>job_params = {}<EOL>job_params['<STR_LIT>'] = cls._label_params_from_dict(job.get('<STR_LIT>', {}))<EOL>job_params['<STR_LIT>'] = cls._env_params_from_dict(job.get('<STR_LIT>', {}))<EOL>job_params['<STR_LIT>'] = cls._input_file_params_from_dict(<EOL>job.get('<STR_LIT>', {}), False)<EOL>job_params['<STR_LIT>'] = cls._input_file_params_from_dict(<EOL>job.get('<STR_LIT>', {}), True)<EOL>job_params['<STR_LIT>'] = cls._output_file_params_from_dict(<EOL>job.get('<STR_LIT>', {}), False)<EOL>job_params['<STR_LIT>'] = cls._output_file_params_from_dict(<EOL>job.get('<STR_LIT>', {}), True)<EOL>job_params['<STR_LIT>'] = cls._mount_params_from_dict(job.get('<STR_LIT>', {}))<EOL>task_descriptors = []<EOL>for task in job.get('<STR_LIT>', []):<EOL><INDENT>task_metadata = {'<STR_LIT>': task.get('<STR_LIT>')}<EOL>create_time = task.get('<STR_LIT>')<EOL>if create_time:<EOL><INDENT>task_metadata['<STR_LIT>'] = dsub_util.replace_timezone(<EOL>create_time, pytz.utc)<EOL><DEDENT>if task.get('<STR_LIT>') is not None:<EOL><INDENT>task_metadata['<STR_LIT>'] = task.get('<STR_LIT>')<EOL><DEDENT>task_params = {}<EOL>task_params['<STR_LIT>'] = cls._label_params_from_dict(<EOL>task.get('<STR_LIT>', {}))<EOL>task_params['<STR_LIT>'] = cls._env_params_from_dict(task.get('<STR_LIT>', {}))<EOL>task_params['<STR_LIT>'] = cls._input_file_params_from_dict(<EOL>task.get('<STR_LIT>', {}), False)<EOL>task_params['<STR_LIT>'] = cls._input_file_params_from_dict(<EOL>task.get('<STR_LIT>', {}), True)<EOL>task_params['<STR_LIT>'] = cls._output_file_params_from_dict(<EOL>task.get('<STR_LIT>', {}), False)<EOL>task_params['<STR_LIT>'] = cls._output_file_params_from_dict(<EOL>task.get('<STR_LIT>', {}), True)<EOL>task_resources = Resources(logging_path=task.get('<STR_LIT>'))<EOL>task_descriptors.append(<EOL>TaskDescriptor(task_metadata, task_params, task_resources))<EOL><DEDENT>return JobDescriptor(job_metadata, job_params, job_resources,<EOL>task_descriptors)<EOL>
Populate and return a JobDescriptor from a YAML string.