support context api in task creator function, add tests and document for this.