@dallinger.command()<EOL>@click.option("<STR_LIT>", default=None, callback=verify_id, help="<STR_LIT>")<EOL>@click.option(<EOL>"<STR_LIT>",<EOL>is_flag=True,<EOL>flag_value=True,<EOL>help="<STR_LIT>",<EOL>)<EOL>def expire(app, sandbox, exit=True):
success = []<EOL>failures = []<EOL>service = _mturk_service_from_config(sandbox)<EOL>hits = _current_hits(service, app)<EOL>for hit in hits:<EOL><INDENT>hit_id = hit["<STR_LIT:id>"]<EOL>try:<EOL><INDENT>service.expire_hit(hit_id)<EOL>success.append(hit_id)<EOL><DEDENT>except MTurkServiceException:<EOL><INDENT>failures.append(hit_id)<EOL><DEDENT><DEDENT>out = Output()<EOL>if success:<EOL><INDENT>out.log("<STR_LIT>".format(len(success), "<STR_LIT:U+002CU+0020>".join(success)))<EOL><DEDENT>if failures:<EOL><INDENT>out.log(<EOL>"<STR_LIT>".format(len(failures), "<STR_LIT:U+002CU+0020>".join(failures))<EOL>)<EOL><DEDENT>if not success and not failures:<EOL><INDENT>out.log("<STR_LIT>")<EOL>if not sandbox:<EOL><INDENT>out.log(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(app)<EOL>)<EOL><DEDENT><DEDENT>if exit and not success:<EOL><INDENT>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>
Expire hits for an experiment id.