def _update_tasks_redundancy(config, task_id, redundancy, limit=<NUM_LIT>, offset=<NUM_LIT:0>):
try:<EOL><INDENT>project = find_project_by_short_name(config.project['<STR_LIT>'],<EOL>config.pbclient,<EOL>config.all)<EOL>if task_id:<EOL><INDENT>response = config.pbclient.find_tasks(project.id, id=task_id)<EOL>check_api_error(response)<EOL>task = response[<NUM_LIT:0>]<EOL>task.n_answers = redundancy<EOL>response = config.pbclient.update_task(task)<EOL>check_api_error(response)<EOL>msg = "<STR_LIT>" % (task_id,<EOL>redundancy)<EOL>return msg<EOL><DEDENT>else:<EOL><INDENT>limit = limit<EOL>offset = offset<EOL>tasks = config.pbclient.get_tasks(project.id, limit, offset)<EOL>with click.progressbar(tasks, label="<STR_LIT>") as pgbar:<EOL><INDENT>while len(tasks) > <NUM_LIT:0>:<EOL><INDENT>for t in pgbar:<EOL><INDENT>t.n_answers = redundancy<EOL>response = config.pbclient.update_task(t)<EOL>check_api_error(response)<EOL>sleep, msg = enable_auto_throttling(config, tasks)<EOL>if sleep:  <EOL><INDENT>time.sleep(sleep)<EOL><DEDENT><DEDENT>offset += limit<EOL>tasks = config.pbclient.get_tasks(project.id, limit, offset)<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT>except exceptions.ConnectionError:<EOL><INDENT>return ("<STR_LIT>" % config.server)<EOL><DEDENT>except (ProjectNotFound, TaskNotFound):<EOL><INDENT>raise<EOL><DEDENT>
Update tasks redundancy from a project.