Skip to content

Commit

Permalink
Update CDK to v6
Browse files Browse the repository at this point in the history
  • Loading branch information
tolik0 committed Nov 8, 2024
1 parent ba18184 commit 1270539
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 14 deletions.
3 changes: 3 additions & 0 deletions airbyte-integrations/connectors/source-jira/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
omit =
source_jira/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ acceptance_tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
bypass_reason: "This test does not make sense using Concurrent CDK"
full_refresh:
tests:
- config_path: "secrets/config.json"
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-jira/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 68e63de2-bb83-4c7e-93fa-a8a9051e3993
dockerImageTag: 3.3.0-rc.1
dockerImageTag: 3.3.0-rc.2
dockerRepository: airbyte/source-jira
documentationUrl: https://docs.airbyte.com/integrations/sources/jira
erdUrl: https://dbdocs.io/airbyteio/source-jira?view=relationships
Expand Down
4 changes: 2 additions & 2 deletions airbyte-integrations/connectors/source-jira/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "3.3.0-rc.1"
version = "3.3.0-rc.2"
name = "source-jira"
description = "Source implementation for Jira."
authors = [ "Airbyte <[email protected]>",]
Expand All @@ -17,7 +17,7 @@ include = "source_jira"

[tool.poetry.dependencies]
python = "^3.10,<3.12"
airbyte-cdk = "^5"
airbyte-cdk = "^6"

[tool.poetry.scripts]
source-jira = "source_jira.run:run"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1416,3 +1416,8 @@ check:
- board_issues
- issues
- sprint_issues

concurrency_level:
type: ConcurrencyLevel
default_concurrency: "{{ config.get('num_workers', 3) }}"
max_concurrency: 40
51 changes: 45 additions & 6 deletions airbyte-integrations/connectors/source-jira/source_jira/run.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#


import sys
import traceback
from datetime import datetime
from typing import List

from airbyte_cdk.entrypoint import launch
from airbyte_cdk.entrypoint import AirbyteEntrypoint, launch, logger
from airbyte_cdk.exception_handler import init_uncaught_exception_handler
from airbyte_cdk.models import AirbyteErrorTraceMessage, AirbyteMessage, AirbyteMessageSerializer, AirbyteTraceMessage, TraceType, Type
from orjson import orjson
from source_jira import SourceJira


def run():
source = SourceJira()
launch(source, sys.argv[1:])
def _get_source(args: List[str]):
catalog_path = AirbyteEntrypoint.extract_catalog(args)
config_path = AirbyteEntrypoint.extract_config(args)
state_path = AirbyteEntrypoint.extract_state(args)
try:
return SourceJira(
SourceJira.read_catalog(catalog_path) if catalog_path else None,
SourceJira.read_config(config_path) if config_path else None,
SourceJira.read_state(state_path) if state_path else None,
)
except Exception as error:
print(
orjson.dumps(
AirbyteMessageSerializer.dump(
AirbyteMessage(
type=Type.TRACE,
trace=AirbyteTraceMessage(
type=TraceType.ERROR,
emitted_at=int(datetime.now().timestamp() * 1000),
error=AirbyteErrorTraceMessage(
message=f"Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance. Error: {error}",
stack_trace=traceback.format_exc(),
),
),
)
)
).decode()
)
return None


def run() -> None:
init_uncaught_exception_handler(logger)
_args = sys.argv[1:]
source = _get_source(_args)
if source:
launch(source, _args)
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
from logging import Logger
from typing import Any, List, Mapping, Tuple
from typing import Any, List, Mapping, Optional, Tuple

import pendulum
from airbyte_cdk.models import FailureType
from airbyte_cdk.models import ConfiguredAirbyteCatalog, FailureType
from airbyte_cdk.sources.declarative.exceptions import ReadException
from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
from airbyte_cdk.sources.source import TState
from airbyte_cdk.sources.streams.core import Stream
from airbyte_cdk.sources.streams.http.requests_native_auth import BasicHttpAuthenticator
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
Expand All @@ -19,8 +20,8 @@


class SourceJira(YamlDeclarativeSource):
def __init__(self):
super().__init__(**{"path_to_yaml": "manifest.yaml"})
def __init__(self, catalog: Optional[ConfiguredAirbyteCatalog], config: Optional[Mapping[str, Any]], state: TState, **kwargs):
super().__init__(catalog=catalog, config=config, state=state, **{"path_to_yaml": "manifest.yaml"})

def check_connection(self, logger: Logger, config: Mapping[str, Any]) -> Tuple[bool, any]:
try:
Expand Down
10 changes: 10 additions & 0 deletions airbyte-integrations/connectors/source-jira/source_jira/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@
"description": "Allow the use of experimental streams which rely on undocumented Jira API endpoints. See https://docs.airbyte.com/integrations/sources/jira#experimental-tables for more info.",
"default": false,
"order": 6
},
"num_workers": {
"type": "integer",
"title": "Number of concurrent workers",
"minimum": 1,
"maximum": 40,
"default": 3,
"examples": [1, 2, 3],
"description": "The number of worker threads to use for the sync.",
"order": 3
}
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/jira.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ The Jira connector should not run into Jira API limitations under normal usage.

| Version | Date | Pull Request | Subject |
|:-----------|:-----------|:-----------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 3.3.0-rc.2 | 2024-11-08 | [38612](https://github.com/airbytehq/airbyte/pull/38612) | Add substream state migration. Update CDK to v6. |
| 3.3.0-rc.1 | 2024-10-28 | [38612](https://github.com/airbytehq/airbyte/pull/38612) | Migrate IssueComments and IssueWorklogs streams to low-code (This change is irreversible) |
| 3.2.1 | 2024-10-12 | [44650](https://github.com/airbytehq/airbyte/pull/44650) | Update dependencies |
| 3.2.0 | 2024-10-10 | [46344](https://github.com/airbytehq/airbyte/pull/46344) | Update CDK v5 |
Expand Down

0 comments on commit 1270539

Please sign in to comment.