Hello all,i would like to trigger my airflow DAG from a python script. I found a way in the documentation to triggering it from a cloud function:For the python specific part of the job, I found help here:With these help, I was able to write a short script, which fetches me a jwt token. If I decompile it, its payload looks like this:
{"aud": "https://MY-COMPOSER-SERVER.appspot.com","sub": "108920719766590804550","email": "SOME-ID-compute@developer.gserviceaccount.com",
The service account identified by the SOME-ID-compute@developer.gserviceaccount.com mail address has the following roles in the same project, where the composer environment resides:
- BigQuery Data Editor
- Composer User
- Editor
- Service Account Token Creator
I target the following URL with my POST request:https://MY-COMPOSER-SERVER.appspot.com/api/experimental/dags/MY-DAG-ID/dag_runsWhen I send the request to Composer with this token as an "Authorization: Bearer" header, I get an HTTP 401 response.Could you please help me, what could be wrong with my request?Thank you very much.
--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.
To post to this group, send email to cloud-composer-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-composer-discuss/CAGhLTk3SA6BVW65YQGp-NfCRXEHGDTs6bGPTimrMbrYbmbhezw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-di...@googlegroups.com.
To post to this group, send email to cloud-compo...@googlegroups.com.
Hi,at the moment, its running on my local workstation. As Wilson pointed out, I my issue was the wrong client id.Thank you all.
On Thu, Jun 28, 2018 at 10:14 PM Tim Swast <sw...@google.com> wrote:
Where is this Python script running from? Based on SOME-ID-compute@developer.gserviceaccount.com I assume either GCE or GKE? I believe you have found the correct sample to follow, if that's the case. It should be accessing via a service account: https://cloud.google.com/iap/docs/authentication-howto#authenticating_from_a_service_account
I believe that access to the Composer web environment is handled via the Composer User role (someone on the Composer team, please verify). You may need to add that role to the service account.• Tim Swast
• Software Friendliness Engineer
• Google Cloud Developer Relations• Seattle, WA, USA
On Wed, Jun 27, 2018 at 5:00 AM Balázs Bartl <balazs...@doctusoft.com> wrote:
Hello all,i would like to trigger my airflow DAG from a python script. I found a way in the documentation to triggering it from a cloud function:For the python specific part of the job, I found help here:With these help, I was able to write a short script, which fetches me a jwt token. If I decompile it, its payload looks like this:
{"aud": "https://MY-COMPOSER-SERVER.appspot.com","sub": "108920719766590804550","email": "SOME-ID-compute@developer.gserviceaccount.com",
The service account identified by the SOME-ID-compute@developer.gserviceaccount.com mail address has the following roles in the same project, where the composer environment resides:
- BigQuery Data Editor
- Composer User
- Editor
- Service Account Token Creator
I target the following URL with my POST request:https://MY-COMPOSER-SERVER.appspot.com/api/experimental/dags/MY-DAG-ID/dag_runsWhen I send the request to Composer with this token as an "Authorization: Bearer" header, I get an HTTP 401 response.Could you please help me, what could be wrong with my request?Thank you very much.
--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.
To post to this group, send email to cloud-composer-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-composer-discuss/CAGhLTk3SA6BVW65YQGp-NfCRXEHGDTs6bGPTimrMbrYbmbhezw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-composer-discuss/CAGhLTk36Q4CyDvAzAkFk2M5%2BuKJLTcuaVYSEBApTRV-phpzVdg%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.
To post to this group, send email to cloud-composer-discuss@googlegroups.com.