Mrhacktivist commented on issue #37228:
URL: https://github.com/apache/airflow/issues/37228#issuecomment-1933855751
CLI USED -
```python
```
import boto3
import json
import requests
import base64
mwaa_env_name = 'MyAirflowEnvironment5'
mwaa_cli_command = 'dags list -o json'
client = boto3.client('mwaa')
mwaa_cli_token = client.create_cli_token(
Name=mwaa_env_name
)
mwaa_auth_token = 'Bearer ' + mwaa_cli_token['CliToken']
mwaa_webserver_hostname =
'https://{0}/aws_mwaa/cli'.format(mwaa_cli_token['WebServerHostname'])
raw_data = '{0}'.format(mwaa_cli_command)
mwaa_response = requests.post(
mwaa_webserver_hostname,
headers={
'Authorization': mwaa_auth_token,
'Content-Type': 'text/plain'
},
data=raw_data
)
mwaa_std_err_message =
base64.b64decode(mwaa_response.json()['stderr']).decode('utf8')
mwaa_std_out_message =
base64.b64decode(mwaa_response.json()['stdout']).decode('utf8')
print(mwaa_response.status_code)
print(mwaa_std_err_message)
print(mwaa_std_out_message)
```
```
Output -
```
Sample operation result: <Task(DatabricksSqlOperator): select_data>
Sample operation type: <class
'airflow.providers.databricks.operators.databricks_sql.DatabricksSqlOperator'>
[{"dag_id": "pl_CustomerPortfolios_Load", "filepath":
"pl_CustomerPortfolios_Load.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_api", "filepath": "pl_api.py", "owner": "airflow", "paused":
"False"}, {"dag_id": "pl_combined_ingestion", "filepath":
"pl_combined_ingestion.py", "owner": "airflow", "paused": "False"}, {"dag_id":
"pl_copy_source_file_from_ingress", "filepath":
"pl_copy_source_file_from_ingress.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_database_cdc_full_ingestion", "filepath":
"pl_database_cdc_full_ingestion.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_database_cdc_ingestion", "filepath":
"pl_database_cdc_ingestion.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_database_full_ingestion", "filepath":
"pl_database_full_ingestion.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_database_ingestion", "filepath": "pl_database_ingestion.py",
"owner": "airflow", "paused": "False"}, {"dag_id": "pl_database_inge
stion_hotelkey", "filepath": "pl_database_ingestion_hotelkey.py", "owner":
"airflow", "paused": "False"}, {"dag_id": "pl_database_ingestion_onprem",
"filepath": "pl_database_ingestion_onprem.py", "owner": "airflow", "paused":
"False"}, {"dag_id": "pl_email_notification", "filepath":
"pl_email_notification.py", "owner": "airflow", "paused": "False"}, {"dag_id":
"pl_file_ingestion", "filepath": "pl_file_ingestion.py", "owner": "airflow",
"paused": "False"}, {"dag_id": "pl_initiate_ingestion", "filepath":
"pl_initiate_ingestion.py", "owner": "airflow", "paused": "False"}, {"dag_id":
"pl_int021_Load", "filepath": "pl_int021_Load.py", "owner": "airflow",
"paused": "False"}, {"dag_id": "pl_invoke_databricks_workflow", "filepath":
"pl_invoke_databricks_workflow.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_oci_ingestion", "filepath": "pl_oci_ingestion.py", "owner":
"airflow", "paused": "False"}, {"dag_id": "pl_onyx_to_egress", "filepath":
"pl_onyx_to_egress.py", "owner": "air
flow", "paused": "False"}, {"dag_id": "pl_prep_layer_only", "filepath":
"pl_prep_layer_only.py", "owner": "airflow", "paused": "False"}, {"dag_id":
"pl_prep_only", "filepath": "pl_prep_only.py", "owner": "airflow", "paused":
"False"}, {"dag_id": "pl_pyspark_test", "filepath": "pl_pyspark_test.py",
"owner": "airflow", "paused": "False"}, {"dag_id": "pl_raw_ingestion_log",
"filepath": "pl_raw_ingestion_log.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_snowflake", "filepath": "pl_snowflake.py", "owner": "airflow",
"paused": "False"}, {"dag_id": "pl_source_table_count_debug", "filepath":
"pl_source_table_count_debug.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_tableau_trigger", "filepath": "pl_tableau_trigger.py", "owner":
"airflow", "paused": "False"}, {"dag_id": "pl_test_airflow_s3_connections",
"filepath": "pl_test_airflow_s3_connections.py", "owner": "airflow", "paused":
"False"}, {"dag_id": "pl_test_db_connectivity", "filepath":
"pl_test_db_connectivity
.py", "owner": "airflow", "paused": "False"}, {"dag_id": "pl_test_exception",
"filepath": "pl_test_exception.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_test_ingress_connection", "filepath":
"pl_test_ingress_connection.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_test_new_ingress_connection", "filepath":
"pl_test_new_ingress_connection.py", "owner": "airflow", "paused": "False"},
{"dag_id": "pl_threshold_trigger", "filepath": "pl_threshold_trigger.py",
"owner": "airflow", "paused": "False"}, {"dag_id": "pl_zip_files", "filepath":
"pl_zip_files.py", "owner": "airflow", "paused": "False"}]
```
Yes the respective operator is used in DAG
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]