Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle crawler timeout gracefully #980

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__pycache__/
*.py[cod]
*$py.class
*
!metaphor
!README.md
!pyproject.toml
!poetry.lock
12 changes: 3 additions & 9 deletions metaphor/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
import subprocess
from importlib import import_module

from metaphor.common.cli import parse_args

Check warning on line 4 in metaphor/__main__.py

View check run for this annotation

Codecov / codecov/patch

metaphor/__main__.py#L4

Added line #L4 was not covered by tests
from metaphor.common.logger import get_logger

logger = get_logger()
Expand All @@ -19,19 +19,13 @@
def main():
print_packages()

parser = argparse.ArgumentParser(description="Metaphor Connectors")

parser.add_argument(
"name", help="Name of the connector, e.g. snowflake or bigquery"
)
parser.add_argument("config", help="Path to the config file")
args = parser.parse_args()
args = parse_args()

Check warning on line 22 in metaphor/__main__.py

View check run for this annotation

Codecov / codecov/patch

metaphor/__main__.py#L22

Added line #L22 was not covered by tests

package_main = getattr(import_module(f"metaphor.{args.name}"), "main", None)
if package_main is None:
raise ValueError(f"Unable to load {args.package}:main")

logger.info(f"Executing {args.name} connector with config file {args.config}")

package_main(args.config)


Expand Down
12 changes: 12 additions & 0 deletions metaphor/common/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
from typing import Type

from metaphor.common.base_config import BaseConfig
Expand All @@ -6,6 +7,17 @@
from metaphor.common.runner import run_connector


def parse_args():
parser = argparse.ArgumentParser(description="Metaphor Connectors")

Check warning on line 11 in metaphor/common/cli.py

View check run for this annotation

Codecov / codecov/patch

metaphor/common/cli.py#L11

Added line #L11 was not covered by tests

parser.add_argument(

Check warning on line 13 in metaphor/common/cli.py

View check run for this annotation

Codecov / codecov/patch

metaphor/common/cli.py#L13

Added line #L13 was not covered by tests
"name", help="Name of the connector, e.g. snowflake or bigquery"
)
parser.add_argument("config", help="Path to the config file")
args = parser.parse_args()
return args

Check warning on line 18 in metaphor/common/cli.py

View check run for this annotation

Codecov / codecov/patch

metaphor/common/cli.py#L16-L18

Added lines #L16 - L18 were not covered by tests


def cli_main(extractor_cls: Type[BaseExtractor], config_file: str):
base_config = BaseConfig.from_yaml_file(config_file)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metaphor-connectors"
version = "0.14.101"
version = "0.14.102"
license = "Apache-2.0"
description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app."
authors = ["Metaphor <[email protected]>"]
Expand Down
Loading