Skip to content

[Core] C++ Response Handling: Update Core Service for New Allocation Response Format #1517

@AronPerez

Description

@AronPerez

Description

As a C++ core service developer, I want to update the allocation response handling to support both task-based and direct execution methods so that the core service can properly handle responses from both Globus and metadata-only repositories.

Implementation Details

New Response Handling:

// Pseudo-code for handling new response format
json response = callFoxxAPI("/repo/alloc/create", params);

if (response["execution_method"] == "direct") {
    // Extract allocation data directly
    auto allocation = response["result"]["allocation"];
    // Create dummy task for backward compatibility if needed
    return createCompletedTask(allocation);
} else if (response["execution_method"] == "task") {
    // Handle as before
    return response["task"];
} else {
    throw std::runtime_error("Unknown execution_method: " + response["execution_method"].get<std::string>());
}

Repository Type Handling:

// Add type field to repository creation
// Note: Until protobuf is updated, may need to pass type through
// existing fields or separate parameter
payload["type"] = determineRepoType(a_request);

Testing Requirements

  • Test allocation creation for metadata-only repos
  • Test allocation creation for Globus repos
  • Test error handling for malformed responses
  • Verify backward compatibility with existing Python clients
  • Performance test for direct execution path

Acceptance Criteria

  • Update taskInitRepoAllocationCreate to handle new response format
  • Update taskInitRepoAllocationDelete to handle new response format
  • Parse 'execution_method' field to determine response type
  • Handle 'direct' execution method by extracting result data
  • Handle 'task' execution method with existing task processing
  • Create appropriate task objects for metadata-only repos (if needed for backward compatibility)
  • Update error handling for new response structure
  • Ensure backward compatibility with existing clients

Resources

  • Engineering Design Document: spec.md - C++ Core Service Changes section
  • Current implementation:
    • taskInitRepoAllocationCreate: core/server/DatabaseAPI.cpp:3373
    • taskInitRepoAllocationDelete: core/server/DatabaseAPI.cpp:3387
    • repoCreate method: core/server/DatabaseAPI.cpp:2156

Dependencies

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions