Skip to main content
Google Cloud
Documentation Technology areas
  • AI and ML
  • Application development
  • Application hosting
  • Compute
  • Data analytics and pipelines
  • Databases
  • Distributed, hybrid, and multicloud
  • Generative AI
  • Industry solutions
  • Networking
  • Observability and monitoring
  • Security
  • Storage
Cross-product tools
  • Access and resources management
  • Costs and usage management
  • Google Cloud SDK, languages, frameworks, and tools
  • Infrastructure as code
  • Migration
Related sites
  • Google Cloud Home
  • Free Trial and Free Tier
  • Architecture Center
  • Blog
  • Contact Sales
  • Google Cloud Developer Center
  • Google Developer Center
  • Google Cloud Marketplace
  • Google Cloud Marketplace Documentation
  • Google Cloud Skills Boost
  • Google Cloud Solution Center
  • Google Cloud Support
  • Google Cloud Tech Youtube Channel
/
  • English
  • Deutsch
  • Español – América Latina
  • Français
  • Português – Brasil
  • 中文 – 简体
  • 日本語
  • 한국어
Console Sign in
  • Python
Overview Guides Reference Samples
Contact Us Start free
Google Cloud
  • Documentation
    • Overview
    • Guides
    • Reference
    • Samples
  • Technology areas
    • More
  • Cross-product tools
    • More
  • Related sites
    • More
  • Console
  • Contact Us
  • Start free
  • Overview
  • Library reference docs
  • BigQuery DataFrames
  • google-cloud-aiplatform
  • google-cloud-apphub
  • google-cloud-artifact-registry
  • google-cloud-asset
  • google-cloud-bigquery
  • google-cloud-bigquery-storage
  • google-cloud-bigtable
  • google-cloud-chronicle
  • google-cloud-compute
  • google-cloud-containeranalysis
  • google-cloud-datacatalog
  • google-cloud-dataplex
  • google-cloud-datastore
  • google-cloud-datastream
  • google-cloud-deploy
  • google-cloud-devicestreaming
  • google-cloud-discoveryengine
  • google-cloud-documentai
  • google-cloud-edgenetwork
  • google-cloud-financialservices
  • google-cloud-firestore
  • google-cloud-functions
  • google-cloud-gdchardwaremanagement
  • google-cloud-gke-backup
  • google-cloud-iam
  • google-cloud-iap
  • google-cloud-logging
  • google-cloud-lustre
  • google-cloud-modelarmor
  • google-cloud-netapp
  • google-cloud-network-management
  • google-cloud-oracledatabase
  • google-cloud-orchestration-airflow
  • google-cloud-org-policy
  • google-cloud-parallelstore
  • google-cloud-pubsub
    • Overview
    • Changelog
    • Multiprocessing
    • Pub/Sub Client Types
    • 2.0.0 Migration Guide
    • Pubsub V1
      • publisher.client
        • Overview
        • Client
      • publisher.futures
        • Overview
        • Future
      • subscriber.client
        • Overview
        • Client
      • subscriber.futures
        • Overview
        • Future
        • StreamingPullFuture
      • scheduler
        • Overview
        • Scheduler
        • ThreadScheduler
      • types
        • Overview
        • AcknowledgeRequest
        • AuditConfig
        • AuditConfigDelta
        • AuditData
        • AuditLogConfig
        • BatchSettings
        • Binding
        • BindingDelta
        • CreateSnapshotRequest
          • Overview
          • LabelsEntry
        • CustomHttpPattern
        • DeadLetterPolicy
        • DeleteSnapshotRequest
        • DeleteSubscriptionRequest
        • DeleteTopicRequest
        • DescriptorProto
          • Overview
          • ExtensionRange
          • ReservedRange
        • DetachSubscriptionRequest
        • DetachSubscriptionResponse
        • Duration
        • Empty
        • EnumDescriptorProto
          • Overview
          • EnumReservedRange
        • EnumOptions
        • EnumValueDescriptorProto
        • EnumValueOptions
        • ExpirationPolicy
        • ExtensionRangeOptions
        • FieldDescriptorProto
        • FieldMask
        • FieldOptions
        • FileDescriptorProto
        • FileDescriptorSet
        • FileOptions
        • FlowControl
        • GeneratedCodeInfo
          • Overview
          • Annotation
        • GetIamPolicyRequest
        • GetSnapshotRequest
        • GetSubscriptionRequest
        • GetTopicRequest
        • Http
        • HttpRule
        • LimitExceededBehavior
        • ListSnapshotsRequest
        • ListSnapshotsResponse
        • ListSubscriptionsRequest
        • ListSubscriptionsResponse
        • ListTopicSnapshotsRequest
        • ListTopicSnapshotsResponse
        • ListTopicSubscriptionsRequest
        • ListTopicSubscriptionsResponse
        • ListTopicsRequest
        • ListTopicsResponse
        • MessageOptions
        • MessageStoragePolicy
        • MethodDescriptorProto
        • MethodOptions
        • ModifyAckDeadlineRequest
        • ModifyPushConfigRequest
        • OneofDescriptorProto
        • OneofOptions
        • Policy
        • PolicyDelta
        • PublishFlowControl
        • PublishRequest
        • PublishResponse
        • PublisherOptions
        • PubsubMessage
          • Overview
          • AttributesEntry
        • PullRequest
        • PullResponse
        • PushConfig
          • Overview
          • AttributesEntry
          • OidcToken
        • ReceivedMessage
        • RetryPolicy
        • SchemaSettings
        • SeekRequest
        • SeekResponse
        • ServiceDescriptorProto
        • ServiceOptions
        • SetIamPolicyRequest
        • Snapshot
          • Overview
          • LabelsEntry
        • SourceCodeInfo
          • Overview
          • Location
        • StreamingPullRequest
        • StreamingPullResponse
          • Overview
          • AcknowledgeConfirmation
          • ModifyAckDeadlineConfirmation
          • SubscriptionProperties
        • Subscription
          • Overview
          • LabelsEntry
        • TestIamPermissionsRequest
        • TestIamPermissionsResponse
        • Timestamp
        • Topic
          • Overview
          • LabelsEntry
        • UninterpretedOption
          • Overview
          • NamePart
        • UpdateSnapshotRequest
        • UpdateSubscriptionRequest
        • UpdateTopicRequest
      • Message
    • Services
      • publisher.pagers
        • Overview
        • ListTopicSnapshotsAsyncPager
        • ListTopicSnapshotsPager
        • ListTopicSubscriptionsAsyncPager
        • ListTopicSubscriptionsPager
        • ListTopicsAsyncPager
        • ListTopicsPager
      • subscriber.pagers
        • Overview
        • ListSnapshotsAsyncPager
        • ListSnapshotsPager
        • ListSubscriptionsAsyncPager
        • ListSubscriptionsPager
  • google-cloud-rapidmigrationassessment
  • google-cloud-recommendations-ai
  • google-cloud-recommender
  • google-cloud-redis
  • google-cloud-retail
  • google-cloud-run
  • google-cloud-runtimeconfig
  • google-cloud-secret-manager
  • google-cloud-securesourcemanager
  • google-cloud-securitycenter
  • google-cloud-securitycentermanagement
  • google-cloud-service-control
  • google-cloud-service-directory
  • google-cloud-service-management
  • google-cloud-service-usage
  • google-cloud-source-context
  • google-cloud-spanner
  • google-cloud-speech
  • google-cloud-storage
  • google-cloud-storage-transfer
  • google-cloud-storagebatchoperations
  • google-cloud-storageinsights
  • google-cloud-support
  • google-cloud-talent
  • google-cloud-texttospeech
  • google-cloud-tpu
  • google-cloud-translate
  • google-cloud-video-stitcher
  • google-cloud-video-transcoder
  • google-cloud-videointelligence
  • google-cloud-vision
  • google-cloud-vm-migration
  • google-cloud-vmwareengine
  • google-cloud-vpc-access
  • google-cloud-webrisk
  • google-cloud-websecurityscanner
  • google-cloud-workflows
  • google-cloud-workstations
  • googleapis-common-protos
  • llama-index-alloydb-pg
  • llama-index-cloud-sql-pg
  • AI and ML
  • Application development
  • Application hosting
  • Compute
  • Data analytics and pipelines
  • Databases
  • Distributed, hybrid, and multicloud
  • Generative AI
  • Industry solutions
  • Networking
  • Observability and monitoring
  • Security
  • Storage
  • Access and resources management
  • Costs and usage management
  • Google Cloud SDK, languages, frameworks, and tools
  • Infrastructure as code
  • Migration
  • Google Cloud Home
  • Free Trial and Free Tier
  • Architecture Center
  • Blog
  • Contact Sales
  • Google Cloud Developer Center
  • Google Developer Center
  • Google Cloud Marketplace
  • Google Cloud Marketplace Documentation
  • Google Cloud Skills Boost
  • Google Cloud Solution Center
  • Google Cloud Support
  • Google Cloud Tech Youtube Channel
  • Home
  • Python
  • Documentation
  • Reference
Stay organized with collections Save and categorize content based on your preferences.
  • 2.31.0 (latest)
  • 2.30.0
  • 2.29.1
  • 2.28.0
  • 2.27.3
  • 2.26.1
  • 2.25.2
  • 2.23.1
  • 2.22.0
  • 2.21.5
  • 2.20.3
  • 2.19.8
  • 2.18.4
  • 2.17.1
  • 2.16.1
  • 2.15.2
  • 2.14.1
  • 2.13.12
  • 2.12.1
  • 2.11.1
  • 2.10.0
  • 2.9.0
  • 2.8.0
  • 2.7.1
  • 2.6.1
  • 2.5.0
  • 2.4.2
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.7.2
  • 1.6.1
  • 1.5.0
  • 1.4.3
  • 1.3.1
  • 1.2.0
  • 1.1.0
  • 1.0.2
  • 0.45.0
  • 0.44.0
  • 0.43.0

Multiprocessing

NOTE: Because this client uses grpc library, it is safe to share instances across threads. In multiprocessing scenarios, the best practice is to create client instances after the invocation of os.fork() by multiprocessing.pool.Pool or multiprocessing.Process.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the