Skip to content

Commit

Permalink
Merge branch 'main' of github.com-dwreeves:astronomer/astronomer-cosm…
Browse files Browse the repository at this point in the history
…os into support-static-index
  • Loading branch information
dwreeves committed Jun 3, 2024
2 parents 6ce3bb4 + 6ceb7f2 commit f40edd6
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 4 deletions.
145 changes: 145 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
name: Bug Report
description: File a bug report.
title: "[Bug]: "
labels: ["bug", "triage-needed"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: dropdown
id: cosmos-version
attributes:
label: Astronomer Cosmos Version
description: What version of Astronomer Cosmos are you running? If you do not see your version in the list, please (ideally) test on
the latest release or main to see if the issue is fixed before reporting it.
options:
- "1.4.1"
- "main (development)"
- "Other Astronomer Cosmos version (please specify below)"
multiple: false
validations:
required: true
- type: input
attributes:
label: If "Other Astronomer Cosmos version" selected, which one?
# yamllint disable rule:line-length
description: >
On what version of Astronomer Cosmos are you currently experiencing the issue? Remember, you are encouraged to
test with the latest release or on the main branch to verify your issue still exists.
- type: input
id: dbt-core-version
attributes:
label: dbt-core version
description: What version of dbt-core are you running?
placeholder: ex. 1.8.0
validations:
required: true
- type: textarea
attributes:
label: Versions of dbt adapters
description: What dbt adapter versions are you using?
placeholder: You can use `pip freeze | grep dbt` (you can leave only relevant ones)
- type: input
id: airflow-version
attributes:
label: airflow version
description: What version of Apache Airflow are you running?
placeholder: ex. 2.9.0
validations:
required: true
- type: input
attributes:
label: Operating System
description: What Operating System are you using?
placeholder: "You can get it via `cat /etc/os-release` for example"
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: If a you think it's an UI issue, what browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- type: dropdown
attributes:
label: Deployment
description: >
What kind of deployment do you have?
multiple: false
options:
- "Official Apache Airflow Helm Chart"
- "Other 3rd-party Helm chart"
- "Docker-Compose"
- "Other Docker-based deployment"
- "Virtualenv installation"
- "Astronomer"
- "Google Cloud Composer"
- "Amazon (AWS) MWAA"
- "Microsoft ADF Managed Airflow"
- "Other"
validations:
required: true
- type: textarea
attributes:
label: Deployment details
description: Additional description of your deployment.
placeholder: >
Enter any relevant details of your deployment. Especially version of your tools,
software (docker-compose, helm, k8s, etc.), any customisation and configuration you added.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
attributes:
label: How to reproduce
description: What should we do to reproduce the problem?
placeholder: >
Please make sure you provide a reproducible step-by-step case of how to reproduce the problem
as minimally and precisely as possible. Keep in mind we do not have access to your cluster or DAGs.
Remember that non-reproducible issues make it hard for us to help you or resolve the issue!
validations:
required: true
- type: textarea
attributes:
label: Anything else :)?
description: Anything else we need to know?
placeholder: >
How often does this problem occur? (Once? Every time? Only when certain conditions are met?)
- type: checkboxes
attributes:
label: Are you willing to submit PR?
description: >
This is absolutely not required, but we are happy to guide you in the contribution process
especially if you already have a good understanding of how to implement the fix. We love to bring new
contributors in.
options:
- label: Yes I am willing to submit a PR!
- type: input
id: contact
attributes:
label: Contact Details
description: (Optional) How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: markdown
attributes:
value: "Thanks for completing our form!"
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/02-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Feature request
description: Suggest an idea for this project
labels: ["enhancement", "needs-triage"]
body:
- type: markdown
attributes:
# yamllint disable rule:line-length
value: "
Thank you for finding the time to propose new feature!
We really appreciate the community efforts to improve Cosmos."
# yamllint enable rule:line-length
- type: textarea
attributes:
label: Description
description: A short description of your feature
- type: textarea
attributes:
label: Use case/motivation
description: What would you like to happen?
- type: textarea
attributes:
label: Related issues
description: Is there currently another issue associated with this?
- type: checkboxes
attributes:
label: Are you willing to submit a PR?
options:
- label: Yes, I am willing to submit a PR!
- type: markdown
attributes:
value: "Thanks for completing our form!"
6 changes: 2 additions & 4 deletions cosmos/operators/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ def handle_exception_subprocess(self, result: FullOutputSubprocessResult) -> Non
if self.skip_exit_code is not None and result.exit_code == self.skip_exit_code:
raise AirflowSkipException(f"dbt command returned exit code {self.skip_exit_code}. Skipping.")
elif result.exit_code != 0:
raise AirflowException(
f"dbt command failed. The command returned a non-zero exit code {result.exit_code}. Details: ",
*result.full_output,
)
logger.error("\n".join(result.full_output))
raise AirflowException(f"dbt command failed. The command returned a non-zero exit code {result.exit_code}.")

def handle_exception_dbt_runner(self, result: dbtRunnerResult) -> None:
"""dbtRunnerResult has an attribute `success` that is False if the command failed."""
Expand Down
20 changes: 20 additions & 0 deletions tests/operators/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
parse_number_of_warnings_dbt_runner,
parse_number_of_warnings_subprocess,
)
from cosmos.hooks.subprocess import FullOutputSubprocessResult
from cosmos.operators.local import (
DbtBuildLocalOperator,
DbtDocsAzureStorageLocalOperator,
Expand Down Expand Up @@ -914,3 +915,22 @@ def test_dbt_local_operator_on_kill_sigterm(mock_send_sigterm) -> None:
dbt_base_operator.on_kill()

mock_send_sigterm.assert_called_once()


def test_handle_exception_subprocess(caplog):
"""
Test the handle_exception_subprocess method of the DbtLocalBaseOperator class for non-zero dbt exit code.
"""
operator = ConcreteDbtLocalBaseOperator(
profile_config=None,
task_id="my-task",
project_dir="my/dir",
)
result = FullOutputSubprocessResult(exit_code=1, output="test", full_output=["n" * n for n in range(1, 1000)])

caplog.set_level(logging.ERROR)
# Test when exit_code is non-zero
with pytest.raises(AirflowException) as err_context:
operator.handle_exception_subprocess(result)
assert len(str(err_context.value)) < 100 # Ensure the error message is not too long
assert len(caplog.text) > 1000 # Ensure the log message is not truncated

0 comments on commit f40edd6

Please sign in to comment.