You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/04/17 19:30:50 UTC

[GitHub] [airflow] mik-laj commented on issue #8272: Cloud Life Sciences operator and hook

mik-laj commented on issue #8272: Cloud Life Sciences operator and hook
URL: https://github.com/apache/airflow/issues/8272#issuecomment-615426469
 
 
   @ephraimbuddy Google Cloud has two types of libraries. 
   * Native python library - https://github.com/googleapis/google-cloud-python  It exists for most, but not for all services. These are recommended. libraries. Most often they use Protobuf for communication.
   * Discovery based - https://github.com/googleapis/google-api-python-client These are libraries that are automatically generated based on the API specification (called the discovery document) at the time of use There are always Googlle services for everyone and they have all the options - it's always fresh. For communication uses HTTP only
   
   We don't have a native library for this library, so we need to use [google-api-client-python](https://github.com/googleapis/google-api-python-client).. In order to initialize the library, you should use the following code.
   ```python
   from googleapiclient.discovery import build
   service = build('lifesciences', 'v2beta', ...)
   ```
   Unfortunately, there is no documentation for this library, but you can build a client and check what methods exist in this API using ipdb
   Documentation for other service is available here:
   https://github.com/googleapis/google-api-python-client/blob/master/docs/dyn/index.md
   
   Here is an example of how to check documentation for dataflow.
   ```python
   from googleapiclient.discovery import build
   dataflow_service = build('dataflow', 'v1b3')
   projects_resource = dataflow_service.projects()
   locations_resource = projects_resource.locations()
   flex_templates_resource = locations_resource.flexTemplates()
   
   print(flex_templates_resource.launch.__doc__)
   ```
   These APIs are automatically generated based on the REST API, so you can check the general idea and required arguments in the REST API documentation for the Life Science service.
   https://cloud.google.com/life-sciences/docs/reference/rest
   
   If you looking for example hook, you should look at Cloud Build:
   https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/hooks/cloud_build.py
   It still uses discovery.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services