Skip to main content
Glama

list_batch_jobs

Retrieve and manage Dataproc batch jobs in Google Cloud by specifying project ID, region, and page size for organized job listing and tracking.

Instructions

List Dataproc batch jobs.

Args: project_id: Google Cloud project ID region: Dataproc region page_size: Number of results per page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNo
project_idYes
regionYes

Implementation Reference

  • MCP tool handler and registration for 'list_batch_jobs'. This @mcp.tool()-decorated function serves as the entry point for the tool, handling parameters, error catching, and delegating to the batch client implementation.
    @mcp.tool() async def list_batch_jobs(project_id: str, region: str, page_size: int = 100) -> str: """List Dataproc batch jobs. Args: project_id: Google Cloud project ID region: Dataproc region page_size: Number of results per page """ batch_client = DataprocBatchClient() try: result = await batch_client.list_batch_jobs(project_id, region, page_size) return str(result) except Exception as e: logger.error("Failed to list batch jobs", error=str(e)) return f"Error: {str(e)}"
  • Core logic for listing batch jobs in the DataprocBatchClient class. Uses Google Cloud's Dataproc v1 BatchControllerClient to fetch and format the list of batch jobs.
    async def list_batch_jobs( self, project_id: str, region: str, page_size: int = 100 ) -> dict[str, Any]: """List batch jobs.""" try: loop = asyncio.get_event_loop() client = self._get_batch_client(region) request = types.ListBatchesRequest( parent=f"projects/{project_id}/locations/{region}", page_size=page_size ) response = await loop.run_in_executor(None, client.list_batches, request) batches = [] for batch in response: batches.append( { "batch_id": batch.name.split("/")[-1], "state": batch.state.name, "create_time": batch.create_time.isoformat() if batch.create_time else None, "job_type": self._get_batch_job_type(batch), "operation": batch.operation if batch.operation else None, } ) return { "batches": batches, "total_count": len(batches), "project_id": project_id, "region": region, } except Exception as e: logger.error("Failed to list batch jobs", error=str(e)) raise

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/warrenzhu25/dataproc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server