Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c738505
make DataMonitoring OK with getting None tracking
RoiTabach Mar 9, 2023
0ef8327
make tracking Optional
RoiTabach Mar 9, 2023
17707ec
Extract _init_dbt_project to a member function in DataMonitoring
RoiTabach Mar 9, 2023
351bed7
Fixed bug where bucket URL was none and report wasn't sent as an html
oravi Mar 10, 2023
a89eeee
ELE 518 Don't add details of Passed tests in Warnings
RoiTabach Mar 15, 2023
117497e
Fixing incorrect group_by flag documentation for slack
vishaalkk Mar 15, 2023
4042c96
Merge pull request #753 from vishaalkk/Fix-slack-alert-documentation
Maayan-s Mar 15, 2023
99f742a
Added @vishaalkk to contributors! 🎉
Maayan-s Mar 15, 2023
75bc7e4
Add target_path flag option for edr files and logs
Mar 13, 2023
ba09d5e
Merge pull request #747 from elementary-data/ele-303-add-target-path
Mar 16, 2023
df2661b
Added @noaKurman and @sadahry to contributors 🎉
Maayan-s Mar 16, 2023
8d1cfc0
Not initializing the tracking object if it's disabled.
elongl Mar 16, 2023
6e98bd4
Merge pull request #757 from elementary-data/no-init-tracking-if-disa…
RoiTabach Mar 16, 2023
55946b1
Add files via upload
Maayan-s Mar 11, 2023
c0ae5a3
Update README.md
Maayan-s Mar 11, 2023
10b715c
Delete report_ui.gif
Maayan-s Mar 11, 2023
42e7824
Add files via upload
Maayan-s Mar 11, 2023
1e6c20e
Update README.md
Maayan-s Mar 13, 2023
65cfd5a
Fixing incorrect group_by flag documentation for slack
vishaalkk Mar 15, 2023
c09ae06
Added @vishaalkk to contributors! 🎉
Maayan-s Mar 15, 2023
f347b88
Add target_path flag option for edr files and logs
Mar 13, 2023
8604311
Added @noaKurman and @sadahry to contributors 🎉
Maayan-s Mar 16, 2023
6948194
Not initializing the tracking object if it's disabled.
elongl Mar 16, 2023
650f3c6
force slack-sdk 3.20.1
RoiTabach Mar 16, 2023
f7cc303
pre-commit fix
RoiTabach Mar 16, 2023
dd009b1
add a unit test
RoiTabach Mar 16, 2023
8ff107a
fix failing test
RoiTabach Mar 16, 2023
0eaae19
Merge pull request #746 from elementary-data/ele-502-fix-bug-when-not…
RoiTabach Mar 16, 2023
874408d
Added tracking interface and anonymous cli tracking objects
oravi Mar 18, 2023
6328460
pre-commit fixes
oravi Mar 18, 2023
4e3a31b
Added set_group_id to the tracking ifc
oravi Mar 18, 2023
b6201ac
Merge pull request #744 from elementary-data/ele-466-k8s-create-airfl…
oravi Mar 19, 2023
77cdd53
Added 'proc_err' as a property on 'DbtCommandError'.
elongl Mar 20, 2023
816fb3b
Added 'test_conn' macro.
elongl Mar 20, 2023
d3eafd7
Update question-singular-tests-config.mdx
Maayan-s Mar 20, 2023
f572f62
Added edr monitor debug to help our users debug their elementary prof…
oravi Mar 21, 2023
18bc3db
Added exit code
oravi Mar 21, 2023
a63d8ec
Merge pull request #765 from elementary-data/ele-556-add-elementary-d…
oravi Mar 21, 2023
9d6530b
Fixing incorrect group_by flag documentation for slack
vishaalkk Mar 15, 2023
1e34551
Added @vishaalkk to contributors! 🎉
Maayan-s Mar 15, 2023
db54755
Add target_path flag option for edr files and logs
Mar 13, 2023
9b61ec2
Added @noaKurman and @sadahry to contributors 🎉
Maayan-s Mar 16, 2023
12435fd
Not initializing the tracking object if it's disabled.
elongl Mar 16, 2023
288c17c
Idan CR
RoiTabach Mar 22, 2023
5c545e6
ELE 518 Don't add details of Passed tests in Warnings
RoiTabach Mar 15, 2023
bedaa31
add a unit test
RoiTabach Mar 16, 2023
e981ac5
fix failing test
RoiTabach Mar 16, 2023
38413ca
Idan CR
RoiTabach Mar 22, 2023
7778cc1
Merge remote-tracking branch 'origin/ele-518-passed-tests-are-listed-…
RoiTabach Mar 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-github-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: report.html
path: report.html
path: edr_target/report.html

- name: Upload log
if: always()
uses: actions/upload-artifact@v3
with:
name: edr.log
path: edr.log
path: edr_target/edr.log
4 changes: 2 additions & 2 deletions .github/workflows/test-warehouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: report_${{ inputs.warehouse-type }}_${{ env.BRANCH_NAME }}.html
path: elementary/elementary_report.html
path: elementary/edr_target/elementary_report.html

- name: Write GCS keyfile
env:
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: edr.log
path: elementary/edr.log
path: elementary/edr_target/edr.log

- name: Run Python package e2e tests
if: github.event_name != 'workflow_dispatch' || inputs.should-run-tests
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Check out the [contributions guide](https://docs.elementary-data.com/general/con
<a href="https://github.com/haritamar"><img src="https://github.com/u/11314965?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/Hadarsagiv"><img src="https://github.com/u/119170841?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/RoiTabach"><img src="https://github.com/u/25003091?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/noaKurman"><img src="https://github.com/u/16741969?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/hahnbeelee"><img src="https://github.com/u/55263191?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/seanglynn-thrive"><img src="https://github.com/u/93200565?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/hanywang2"><img src="https://github.com/u/44352119?v=4" width="50" height="50" alt=""/></a>
Expand Down Expand Up @@ -170,6 +171,8 @@ Check out the [contributions guide](https://docs.elementary-data.com/general/con
<a href="https://github.com/Chintanvpatel"><img src="https://github.com/u/1384301?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/andreqaugusto"><img src="https://github.com/u/68784205?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/tc-chrisbui"><img src="https://github.com/u/115048867?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/vishaalkk"><img src="https://github.com/u/13641827?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/sadahry"><img src="https://github.com/u/28292300?v=4" width="50" height="50" alt=""/></a>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand Down
4 changes: 2 additions & 2 deletions docs/_snippets/faq/question-singular-tests-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ You can add configuration to your custom tests with a config block:
{{ config(
tags=["Tag1","Tag2"]
meta={
description: "This is a description",
owner: "Maayan Salom"
"description": "This is a description",
"owner": "Maayan Salom"
}
) }}

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart/send-slack-alerts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ Elementary also supports grouping alerts by table. In this case, a single Slack
To group alerts by table:

```shell
edr monitor --group_by table
edr monitor --group-by table
```

Grouping can also be configured through the yml files. To set it up globaly for your project, add the configuration to your models in the dbt_project.yml file:
Expand Down
6 changes: 6 additions & 0 deletions docs/understand-elementary/cli-commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ Here is a list of all the available options:
The path of the directory in which your `config.yml` file is located. Default is `HOME_DIR/.edr`.

```shell
--target-path <PATH>
```

- **Configuration target directory path**
The absolute path where all output files such as logs and reports will be saved. If not configured, the default is ./edr_target.
```shell
-c, --config-dir <PATH>
```

Expand Down
20 changes: 17 additions & 3 deletions elementary/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any

import click
Expand All @@ -7,9 +8,9 @@
from elementary.config.config import Config
from elementary.monitor.cli import monitor, report, send_report
from elementary.operations.cli import run_operation
from elementary.tracking.anonymous_tracking import AnonymousTracking
from elementary.tracking.anonymous_tracking import AnonymousCommandLineTracking
from elementary.utils import package
from elementary.utils.log import get_logger
from elementary.utils.log import get_logger, set_root_logger_handlers

f = Figlet(font="slant")
click.echo(f.renderText("Elementary"))
Expand All @@ -18,6 +19,17 @@
logger = get_logger(__name__)


def get_log_path(ctx):
file_path = Config.DEFAULT_FILES_PATH
try:
ctx_args = ctx.args
target_path_flag = "--target-path"
file_path = ctx_args[ctx_args.index(target_path_flag) + 1]
finally:
os.makedirs(os.path.abspath(file_path), exist_ok=True)
return os.path.join(file_path, "edr.log")


class ElementaryCLI(click.MultiCommand):
_CMD_MAP = {
"monitor": monitor,
Expand All @@ -36,7 +48,7 @@ def get_command(self, ctx, name):
def format_help(self, ctx, formatter):
try:
click.echo("Loading dependencies (this might take a few seconds)")
AnonymousTracking(config=Config()).track_cli_help()
AnonymousCommandLineTracking(config=Config()).track_cli_help()
except Exception:
pass
self.format_usage(ctx, formatter)
Expand All @@ -45,6 +57,8 @@ def format_help(self, ctx, formatter):
self.format_epilog(ctx, formatter)

def invoke(self, ctx: click.Context) -> Any:
files_target_path = get_log_path(ctx)
set_root_logger_handlers("elementary", files_target_path)
click.echo(
"Any feedback and suggestions are welcomed! join our community here - "
"https://bit.ly/slack-elementary\n"
Expand Down
3 changes: 0 additions & 3 deletions elementary/clients/api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
from typing import Any

from elementary.clients.dbt.base_dbt_runner import BaseDbtRunner
from elementary.utils.log import get_logger

logger = get_logger(__name__)


class APIClient:
Expand Down
1 change: 0 additions & 1 deletion elementary/clients/dbt/slim_dbt_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from dbt.flags import set_from_args
from dbt.parser.manifest import ManifestLoader
from dbt.tracking import disable_tracking
from dbt.version import __version__
from pydantic import BaseModel, validator

from elementary.clients.dbt.base_dbt_runner import BaseDbtRunner
Expand Down
6 changes: 3 additions & 3 deletions elementary/clients/gcs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from google.oauth2 import service_account

from elementary.config.config import Config
from elementary.tracking.anonymous_tracking import AnonymousTracking
from elementary.tracking.tracking_interface import Tracking
from elementary.utils import bucket_path
from elementary.utils.log import get_logger

Expand All @@ -18,14 +18,14 @@


class GCSClient:
def __init__(self, config: Config, tracking: AnonymousTracking = None):
def __init__(self, config: Config, tracking: Tracking = None):
self.config = config
self.client = self.get_client(config)
self.tracking = tracking

@classmethod
def create_client(
cls, config: Config, tracking: AnonymousTracking = None
cls, config: Config, tracking: Tracking = None
) -> Optional["GCSClient"]:
return cls(config, tracking=tracking) if config.has_gcs else None

Expand Down
6 changes: 3 additions & 3 deletions elementary/clients/s3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import boto3

from elementary.config.config import Config
from elementary.tracking.anonymous_tracking import AnonymousTracking
from elementary.tracking.tracking_interface import Tracking
from elementary.utils import bucket_path
from elementary.utils.log import get_logger

logger = get_logger(__name__)


class S3Client:
def __init__(self, config: Config, tracking: AnonymousTracking = None):
def __init__(self, config: Config, tracking: Tracking = None):
self.config = config
aws_session = boto3.Session(
profile_name=config.aws_profile_name,
Expand All @@ -24,7 +24,7 @@ def __init__(self, config: Config, tracking: AnonymousTracking = None):

@classmethod
def create_client(
cls, config: Config, tracking: AnonymousTracking = None
cls, config: Config, tracking: Tracking = None
) -> Optional["S3Client"]:
return cls(config, tracking=tracking) if config.has_s3 else None

Expand Down
11 changes: 5 additions & 6 deletions elementary/clients/slack/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from elementary.clients.slack.schema import SlackMessageSchema
from elementary.config.config import Config
from elementary.tracking.anonymous_tracking import AnonymousTracking
from elementary.tracking.tracking_interface import Tracking
from elementary.utils.log import get_logger

logger = get_logger(__name__)
Expand All @@ -21,7 +21,7 @@

class SlackClient(ABC):
def __init__(
self, token: str = None, webhook: str = None, tracking: AnonymousTracking = None
self, token: str = None, webhook: str = None, tracking: Tracking = None
) -> None:
self.token = token
self.webhook = webhook
Expand All @@ -32,7 +32,7 @@ def __init__(

@staticmethod
def create_client(
config: Config, tracking: AnonymousTracking = None
config: Config, tracking: Tracking = None
) -> Optional["SlackClient"]:
if not config.has_slack:
return None
Expand Down Expand Up @@ -90,7 +90,7 @@ def send_message(
except SlackApiError as err:
if self._handle_send_err(err, channel_name):
return self.send_message(channel_name, message)
self.tracking.record_cli_internal_exception(err)
self.tracking.record_internal_exception(err)
return False

@sleep_and_retry
Expand Down Expand Up @@ -159,8 +159,7 @@ def _join_channel(self, channel_id: str) -> bool:
return True
except SlackApiError as e:
logger.error(f"Elementary app failed to join the given channel. Error: {e}")
if self.tracking:
self.tracking.record_cli_internal_exception(e)
self.tracking.record_internal_exception(e)
return False

def _handle_send_err(self, err: SlackApiError, channel_name: str) -> bool:
Expand Down
5 changes: 5 additions & 0 deletions elementary/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ class Config:

DEFAULT_CONFIG_DIR = str(Path.home() / ".edr")

DEFAULT_FILES_PATH = os.getcwd() + "/edr_target"

def __init__(
self,
config_dir: str = DEFAULT_CONFIG_DIR,
profiles_dir: str = None,
project_dir: str = None,
profile_target: str = None,
project_profile_target: str = None,
target_path: str = DEFAULT_FILES_PATH,
dbt_quoting: bool = None,
update_bucket_website: bool = None,
slack_webhook: str = None,
Expand Down Expand Up @@ -70,9 +73,11 @@ def __init__(
config = self._load_configuration()

self.target_dir = self._first_not_none(
target_path,
config.get("target-path"),
os.getcwd(),
)
os.makedirs(os.path.abspath(self.target_dir), exist_ok=True)

self.update_bucket_website = self._first_not_none(
update_bucket_website,
Expand Down
1 change: 1 addition & 0 deletions elementary/exceptions/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(

# Command args sent to _run_command (without additional user-specific args it as such as projects / profiles
# dir)
self.proc_err = err
self.base_command_args = base_command_args
self.return_code = err.returncode

Expand Down
Loading