def _add_tasks(config, tasks_file, tasks_type, priority, redundancy):
try:<EOL><INDENT>project = find_project_by_short_name(config.project['<STR_LIT>'],<EOL>config.pbclient,<EOL>config.all)<EOL>data = _load_data(tasks_file, tasks_type)<EOL>if len(data) == <NUM_LIT:0>:<EOL><INDENT>return ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>with click.progressbar(data, label="<STR_LIT>") as pgbar:<EOL><INDENT>for d in pgbar:<EOL><INDENT>task_info = create_task_info(d)<EOL>response = config.pbclient.create_task(project_id=project.id,<EOL>info=task_info,<EOL>n_answers=redundancy,<EOL>priority_0=priority)<EOL>sleep, msg = enable_auto_throttling(config, data)<EOL>check_api_error(response)<EOL>if sleep:  <EOL><INDENT>time.sleep(sleep)<EOL><DEDENT><DEDENT>return ("<STR_LIT>" % (len(data),<EOL>config.project['<STR_LIT>']))<EOL><DEDENT><DEDENT>except exceptions.ConnectionError:<EOL><INDENT>return ("<STR_LIT>" % config.server)<EOL><DEDENT>except (ProjectNotFound, TaskNotFound):<EOL><INDENT>raise<EOL><DEDENT>
Add tasks to a project.