Permalink
Browse files

Merge pull request #16 from vlam21/vlam_update_thrift_definition

Update Thrift API: Changes the list of task IDs passed to fetchAnnotatio...
  • Loading branch information...
2 parents ba30d10 + f9b7046 commit 5a999ee026821aaa18c022b56f79cadfa77eb755 @echen echen committed Sep 11, 2012
Showing with 9 additions and 8 deletions.
  1. +4 −3 lib/daemons/human_eval_thrift_daemon.rb
  2. +3 −3 lib/gen-rb/human_eval_types.rb
  3. +2 −2 lib/human_eval.thrift
@@ -19,13 +19,14 @@
require 'thrift'
require 'human_eval_task_manager'
+require 'set'
class HumanEvalTaskManagerHandler
# Initializes Thrift connection state.
def initialize
@processor = HumanEvalTaskManager::Processor.new(self)
- @transport = Thrift::ServerSocket.new(9090)
+ @transport = Thrift::ServerSocket.new(3030)
@transport_factory = Thrift::BufferedTransportFactory.new()
@server = Thrift::SimpleServer.new(@processor, @transport, @transport_factory)
end
@@ -52,9 +53,9 @@ def submitTask(submit_task_params)
# Gets the status of an existing Task, including completion status and answers, if available.
# More details in human_eval.thrift.
def fetchAnnotations(fetch_annotation_params)
- return nil if fetch_annotation_params.nil? or fetch_annotation_params.taskIdList.nil?
+ return nil if fetch_annotation_params.nil? or fetch_annotation_params.taskIdSet.nil?
- task_id_results_map = fetch_annotation_params.taskIdList.each_with_object({}) do |task_id, result|
+ task_id_results_map = fetch_annotation_params.taskIdSet.to_a.each_with_object({}) do |task_id, result|
task_result = HumanEvalTaskResult.new
task = Task.find_by_id(task_id)
@@ -117,16 +117,16 @@ def validate
class HumanEvalFetchAnnotationParams
include ::Thrift::Struct, ::Thrift::Struct_Union
- TASKIDLIST = 1
+ TASKIDSET = 1
FIELDS = {
- TASKIDLIST => {:type => ::Thrift::Types::LIST, :name => 'taskIdList', :element => {:type => ::Thrift::Types::I64}}
+ TASKIDSET => {:type => ::Thrift::Types::SET, :name => 'taskIdSet', :element => {:type => ::Thrift::Types::I64}}
}
def struct_fields; FIELDS; end
def validate
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field taskIdList is unset!') unless @taskIdList
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field taskIdSet is unset!') unless @taskIdSet
end
::Thrift::Struct.generate_accessors self
View
@@ -42,7 +42,7 @@ struct HumanEvalSubmitTaskResponse {
// Structure to represent params to fetch annotations.
struct HumanEvalFetchAnnotationParams {
- 1: required list<i64> taskIdList;
+ 1: required set<i64> taskIdSet;
}
// Structure to represent reponse from fetch annotations.
@@ -55,7 +55,7 @@ service HumanEvalTaskManager {
HumanEvalSubmitTaskResponse submitTask(1: HumanEvalSubmitTaskParams params)
throws (1: HumanEvalException hec)
- // Fetches result for a list of human eval tasks.
+ // Fetches result for a set of human eval tasks.
HumanEvalFetchAnnotationResponse fetchAnnotations(1: HumanEvalFetchAnnotationParams params)
throws (1: HumanEvalException hec)
}

0 comments on commit 5a999ee

Please sign in to comment.