def web_task(f):
@wraps(f)<EOL>def web_task_decorator(*args, **kwargs):<EOL><INDENT>jc = JobContext.get_current_context()<EOL>if not isinstance(jc, WebJobContext):<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>")<EOL><DEDENT>data = f(*args, **kwargs)<EOL>jc.add_responder(WebTaskResponder(data))<EOL>return data['<STR_LIT:data>'] if '<STR_LIT:data>' in data else "<STR_LIT>"<EOL><DEDENT>return web_task_decorator<EOL>
Checks if the task is called through the web interface.
Task return value should be in format {'data': ...}.