Skip to main content
Glama
warrenzhu25

Dataproc MCP Server

by warrenzhu25

cancel_job

Stop a running Dataproc job by specifying project, region, and job ID to manage Google Cloud resources efficiently.

Instructions

Cancel a running job.

Args:
    project_id: Google Cloud project ID
    region: Dataproc region
    job_id: Job ID to cancel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
regionYes
job_idYes

Implementation Reference

  • MCP tool handler and registration for cancel_job using @mcp.tool() decorator. Delegates to DataprocClient.cancel_job.
    @mcp.tool()
    async def cancel_job(project_id: str, region: str, job_id: str) -> str:
        """Cancel a running job.
    
        Args:
            project_id: Google Cloud project ID
            region: Dataproc region
            job_id: Job ID to cancel
        """
        client = DataprocClient()
        try:
            result = await client.cancel_job(project_id, region, job_id)
            return str(result)
        except Exception as e:
            logger.error("Failed to cancel job", error=str(e))
            return f"Error: {str(e)}"
  • DataprocClient method that performs the actual job cancellation using Google Cloud Dataproc API client.
    async def cancel_job(
        self, project_id: str, region: str, job_id: str
    ) -> dict[str, Any]:
        """Cancel a running job."""
        try:
            loop = asyncio.get_event_loop()
            client = self._get_job_client(region)
    
            request = types.CancelJobRequest(
                project_id=project_id, region=region, job_id=job_id
            )
    
            job = await loop.run_in_executor(None, client.cancel_job, request)
    
            return {
                "job_id": job.reference.job_id,
                "status": job.status.state.name,
                "message": f"Job {job_id} cancellation requested",
            }
    
        except Exception as e:
            logger.error("Failed to cancel job", error=str(e))
            raise

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