talend-task 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- talend_task-0.1.0/LICENSE +21 -0
- talend_task-0.1.0/PKG-INFO +146 -0
- talend_task-0.1.0/README.md +119 -0
- talend_task-0.1.0/pyproject.toml +67 -0
- talend_task-0.1.0/setup.cfg +4 -0
- talend_task-0.1.0/talend_task.egg-info/PKG-INFO +146 -0
- talend_task-0.1.0/talend_task.egg-info/SOURCES.txt +10 -0
- talend_task-0.1.0/talend_task.egg-info/dependency_links.txt +1 -0
- talend_task-0.1.0/talend_task.egg-info/entry_points.txt +2 -0
- talend_task-0.1.0/talend_task.egg-info/requires.txt +3 -0
- talend_task-0.1.0/talend_task.egg-info/top_level.txt +1 -0
- talend_task-0.1.0/talend_task.py +166 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Corey Goldberg
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: talend_task
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI for running ETL jobs (tasks) remotely via Talend Cloud API
|
|
5
|
+
Author: Corey Goldberg
|
|
6
|
+
Maintainer: Corey Goldberg
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: homepage, https://github.com/cgoldberg/talend_task
|
|
9
|
+
Project-URL: source, https://github.com/cgoldberg/talend_task
|
|
10
|
+
Project-URL: download, https://pypi.org/project/talend_task
|
|
11
|
+
Keywords: talend,etl,database,api
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: python-dotenv==1.2.2
|
|
24
|
+
Requires-Dist: requests==2.33.1
|
|
25
|
+
Requires-Dist: rich==15.0.0
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# talend-task
|
|
29
|
+
|
|
30
|
+
## CLI for running ETL jobs (tasks) remotely via Talend Cloud API
|
|
31
|
+
|
|
32
|
+
- Copyright (c) 2026 [Corey Goldberg](https://github.com/cgoldberg)
|
|
33
|
+
|
|
34
|
+
<table>
|
|
35
|
+
<tr>
|
|
36
|
+
<td>Development</td>
|
|
37
|
+
<td>
|
|
38
|
+
<a href="https://github.com/cgoldberg/talend-task">
|
|
39
|
+
GitHub
|
|
40
|
+
</a>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>License</td>
|
|
45
|
+
<td>
|
|
46
|
+
<a href="https://raw.githubusercontent.com/cgoldberg/talend-task/refs/heads/master/LICENSE">
|
|
47
|
+
MIT
|
|
48
|
+
</a>
|
|
49
|
+
</td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td>Releases</td>
|
|
53
|
+
<td>
|
|
54
|
+
<a href="https://pypi.org/project/talend-task">
|
|
55
|
+
PyPI
|
|
56
|
+
</a>
|
|
57
|
+
</td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td>Supported Python Versions</td>
|
|
61
|
+
<td>
|
|
62
|
+
3.10+
|
|
63
|
+
</td>
|
|
64
|
+
</tr>
|
|
65
|
+
</table>
|
|
66
|
+
|
|
67
|
+
----
|
|
68
|
+
|
|
69
|
+
## About:
|
|
70
|
+
|
|
71
|
+
`talend-task` is a Python CLI tool for remotely running
|
|
72
|
+
[Talend](https://talend.com) ETL jobs (tasks).
|
|
73
|
+
|
|
74
|
+
You can specify a job to run by its name (using the `--job` argument)
|
|
75
|
+
or it will list all available jobs and let you select which one to run.
|
|
76
|
+
|
|
77
|
+
----
|
|
78
|
+
|
|
79
|
+
## Installation:
|
|
80
|
+
|
|
81
|
+
#### Install from [PyPI](https://pypi.org/project/talend-task):
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
pip install talend-task
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
----
|
|
88
|
+
|
|
89
|
+
## Configuration:
|
|
90
|
+
|
|
91
|
+
You need to configure an Access Token (generated in
|
|
92
|
+
[Talend Management Console](https://help.qlik.com/talend/management-console-user-guide))
|
|
93
|
+
and the API endpoint URL you will connect to (i.e.
|
|
94
|
+
`https://api.<region>.talend.com`).
|
|
95
|
+
|
|
96
|
+
These are setup using the `API_URL` and `ACCESS_TOKEN` environment variables:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
$ export API_URL=<endpoint URL>
|
|
100
|
+
$ export ACCESS_TOKEN=<access token>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
You can also set this in an `.env` file in the current directory.
|
|
104
|
+
|
|
105
|
+
For example:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
API_URL=https://api.us-west.cloud.talend.com
|
|
109
|
+
ACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
----
|
|
113
|
+
|
|
114
|
+
## CLI Options:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
$ talend_task --help
|
|
118
|
+
usage: talend_task [-h] [--wait] [--job JOB]
|
|
119
|
+
|
|
120
|
+
options:
|
|
121
|
+
-h, --help show this help message and exit
|
|
122
|
+
--wait wait for task to complete and show status
|
|
123
|
+
--job JOB Talend ETL task name
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
----
|
|
127
|
+
|
|
128
|
+
## Usage Examples:
|
|
129
|
+
|
|
130
|
+
Launch the CLI to select a job to run:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
talend_task
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Run a job named "MyJob":
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
talend_task --job MyJob
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Run a job named "MyJob" and wait (poll) until the job completes:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
talend_task --wait --job MyJob
|
|
146
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# talend-task
|
|
2
|
+
|
|
3
|
+
## CLI for running ETL jobs (tasks) remotely via Talend Cloud API
|
|
4
|
+
|
|
5
|
+
- Copyright (c) 2026 [Corey Goldberg](https://github.com/cgoldberg)
|
|
6
|
+
|
|
7
|
+
<table>
|
|
8
|
+
<tr>
|
|
9
|
+
<td>Development</td>
|
|
10
|
+
<td>
|
|
11
|
+
<a href="https://github.com/cgoldberg/talend-task">
|
|
12
|
+
GitHub
|
|
13
|
+
</a>
|
|
14
|
+
</td>
|
|
15
|
+
</tr>
|
|
16
|
+
<tr>
|
|
17
|
+
<td>License</td>
|
|
18
|
+
<td>
|
|
19
|
+
<a href="https://raw.githubusercontent.com/cgoldberg/talend-task/refs/heads/master/LICENSE">
|
|
20
|
+
MIT
|
|
21
|
+
</a>
|
|
22
|
+
</td>
|
|
23
|
+
</tr>
|
|
24
|
+
<tr>
|
|
25
|
+
<td>Releases</td>
|
|
26
|
+
<td>
|
|
27
|
+
<a href="https://pypi.org/project/talend-task">
|
|
28
|
+
PyPI
|
|
29
|
+
</a>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>Supported Python Versions</td>
|
|
34
|
+
<td>
|
|
35
|
+
3.10+
|
|
36
|
+
</td>
|
|
37
|
+
</tr>
|
|
38
|
+
</table>
|
|
39
|
+
|
|
40
|
+
----
|
|
41
|
+
|
|
42
|
+
## About:
|
|
43
|
+
|
|
44
|
+
`talend-task` is a Python CLI tool for remotely running
|
|
45
|
+
[Talend](https://talend.com) ETL jobs (tasks).
|
|
46
|
+
|
|
47
|
+
You can specify a job to run by its name (using the `--job` argument)
|
|
48
|
+
or it will list all available jobs and let you select which one to run.
|
|
49
|
+
|
|
50
|
+
----
|
|
51
|
+
|
|
52
|
+
## Installation:
|
|
53
|
+
|
|
54
|
+
#### Install from [PyPI](https://pypi.org/project/talend-task):
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
pip install talend-task
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
----
|
|
61
|
+
|
|
62
|
+
## Configuration:
|
|
63
|
+
|
|
64
|
+
You need to configure an Access Token (generated in
|
|
65
|
+
[Talend Management Console](https://help.qlik.com/talend/management-console-user-guide))
|
|
66
|
+
and the API endpoint URL you will connect to (i.e.
|
|
67
|
+
`https://api.<region>.talend.com`).
|
|
68
|
+
|
|
69
|
+
These are setup using the `API_URL` and `ACCESS_TOKEN` environment variables:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
$ export API_URL=<endpoint URL>
|
|
73
|
+
$ export ACCESS_TOKEN=<access token>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
You can also set this in an `.env` file in the current directory.
|
|
77
|
+
|
|
78
|
+
For example:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
API_URL=https://api.us-west.cloud.talend.com
|
|
82
|
+
ACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
----
|
|
86
|
+
|
|
87
|
+
## CLI Options:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
$ talend_task --help
|
|
91
|
+
usage: talend_task [-h] [--wait] [--job JOB]
|
|
92
|
+
|
|
93
|
+
options:
|
|
94
|
+
-h, --help show this help message and exit
|
|
95
|
+
--wait wait for task to complete and show status
|
|
96
|
+
--job JOB Talend ETL task name
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
----
|
|
100
|
+
|
|
101
|
+
## Usage Examples:
|
|
102
|
+
|
|
103
|
+
Launch the CLI to select a job to run:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
talend_task
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Run a job named "MyJob":
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
talend_task --job MyJob
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Run a job named "MyJob" and wait (poll) until the job completes:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
talend_task --wait --job MyJob
|
|
119
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "talend_task"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI for running ETL jobs (tasks) remotely via Talend Cloud API"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
license-files = ["LICENSE"]
|
|
11
|
+
authors = [{name = "Corey Goldberg"}]
|
|
12
|
+
maintainers = [{name = "Corey Goldberg"}]
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
keywords = ["talend", "etl", "database", "api"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Programming Language :: Python",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"python-dotenv==1.2.2",
|
|
28
|
+
"requests==2.33.1",
|
|
29
|
+
"rich==15.0.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
talend_task = "talend_task:main"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
homepage = "https://github.com/cgoldberg/talend_task"
|
|
37
|
+
source = "https://github.com/cgoldberg/talend_task"
|
|
38
|
+
download = "https://pypi.org/project/talend_task"
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
lint = [
|
|
42
|
+
"black",
|
|
43
|
+
"ruff",
|
|
44
|
+
]
|
|
45
|
+
validate = [
|
|
46
|
+
"packaging",
|
|
47
|
+
"validate-pyproject",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[tool.black]
|
|
51
|
+
line-length = 88
|
|
52
|
+
target-version = ["py310"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
line-length = 88
|
|
56
|
+
respect-gitignore = true
|
|
57
|
+
target-version = "py310"
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = [
|
|
61
|
+
"E", "F", "I", "PT", "RUF", "TID", "W"
|
|
62
|
+
]
|
|
63
|
+
fixable = ["ALL"]
|
|
64
|
+
|
|
65
|
+
[tool.ruff.format]
|
|
66
|
+
docstring-code-line-length = 88
|
|
67
|
+
docstring-code-format = true
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: talend_task
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI for running ETL jobs (tasks) remotely via Talend Cloud API
|
|
5
|
+
Author: Corey Goldberg
|
|
6
|
+
Maintainer: Corey Goldberg
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: homepage, https://github.com/cgoldberg/talend_task
|
|
9
|
+
Project-URL: source, https://github.com/cgoldberg/talend_task
|
|
10
|
+
Project-URL: download, https://pypi.org/project/talend_task
|
|
11
|
+
Keywords: talend,etl,database,api
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: python-dotenv==1.2.2
|
|
24
|
+
Requires-Dist: requests==2.33.1
|
|
25
|
+
Requires-Dist: rich==15.0.0
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# talend-task
|
|
29
|
+
|
|
30
|
+
## CLI for running ETL jobs (tasks) remotely via Talend Cloud API
|
|
31
|
+
|
|
32
|
+
- Copyright (c) 2026 [Corey Goldberg](https://github.com/cgoldberg)
|
|
33
|
+
|
|
34
|
+
<table>
|
|
35
|
+
<tr>
|
|
36
|
+
<td>Development</td>
|
|
37
|
+
<td>
|
|
38
|
+
<a href="https://github.com/cgoldberg/talend-task">
|
|
39
|
+
GitHub
|
|
40
|
+
</a>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>License</td>
|
|
45
|
+
<td>
|
|
46
|
+
<a href="https://raw.githubusercontent.com/cgoldberg/talend-task/refs/heads/master/LICENSE">
|
|
47
|
+
MIT
|
|
48
|
+
</a>
|
|
49
|
+
</td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td>Releases</td>
|
|
53
|
+
<td>
|
|
54
|
+
<a href="https://pypi.org/project/talend-task">
|
|
55
|
+
PyPI
|
|
56
|
+
</a>
|
|
57
|
+
</td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td>Supported Python Versions</td>
|
|
61
|
+
<td>
|
|
62
|
+
3.10+
|
|
63
|
+
</td>
|
|
64
|
+
</tr>
|
|
65
|
+
</table>
|
|
66
|
+
|
|
67
|
+
----
|
|
68
|
+
|
|
69
|
+
## About:
|
|
70
|
+
|
|
71
|
+
`talend-task` is a Python CLI tool for remotely running
|
|
72
|
+
[Talend](https://talend.com) ETL jobs (tasks).
|
|
73
|
+
|
|
74
|
+
You can specify a job to run by its name (using the `--job` argument)
|
|
75
|
+
or it will list all available jobs and let you select which one to run.
|
|
76
|
+
|
|
77
|
+
----
|
|
78
|
+
|
|
79
|
+
## Installation:
|
|
80
|
+
|
|
81
|
+
#### Install from [PyPI](https://pypi.org/project/talend-task):
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
pip install talend-task
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
----
|
|
88
|
+
|
|
89
|
+
## Configuration:
|
|
90
|
+
|
|
91
|
+
You need to configure an Access Token (generated in
|
|
92
|
+
[Talend Management Console](https://help.qlik.com/talend/management-console-user-guide))
|
|
93
|
+
and the API endpoint URL you will connect to (i.e.
|
|
94
|
+
`https://api.<region>.talend.com`).
|
|
95
|
+
|
|
96
|
+
These are setup using the `API_URL` and `ACCESS_TOKEN` environment variables:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
$ export API_URL=<endpoint URL>
|
|
100
|
+
$ export ACCESS_TOKEN=<access token>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
You can also set this in an `.env` file in the current directory.
|
|
104
|
+
|
|
105
|
+
For example:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
API_URL=https://api.us-west.cloud.talend.com
|
|
109
|
+
ACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
----
|
|
113
|
+
|
|
114
|
+
## CLI Options:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
$ talend_task --help
|
|
118
|
+
usage: talend_task [-h] [--wait] [--job JOB]
|
|
119
|
+
|
|
120
|
+
options:
|
|
121
|
+
-h, --help show this help message and exit
|
|
122
|
+
--wait wait for task to complete and show status
|
|
123
|
+
--job JOB Talend ETL task name
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
----
|
|
127
|
+
|
|
128
|
+
## Usage Examples:
|
|
129
|
+
|
|
130
|
+
Launch the CLI to select a job to run:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
talend_task
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Run a job named "MyJob":
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
talend_task --job MyJob
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Run a job named "MyJob" and wait (poll) until the job completes:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
talend_task --wait --job MyJob
|
|
146
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
talend_task.py
|
|
5
|
+
talend_task.egg-info/PKG-INFO
|
|
6
|
+
talend_task.egg-info/SOURCES.txt
|
|
7
|
+
talend_task.egg-info/dependency_links.txt
|
|
8
|
+
talend_task.egg-info/entry_points.txt
|
|
9
|
+
talend_task.egg-info/requires.txt
|
|
10
|
+
talend_task.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
talend_task
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2026 Corey Goldberg
|
|
4
|
+
# License: MIT
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
"""CLI for running ETL jobs (tasks) remotely via Talend Cloud API."""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import logging
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
import time
|
|
14
|
+
from datetime import datetime
|
|
15
|
+
from urllib.parse import urljoin
|
|
16
|
+
|
|
17
|
+
import requests
|
|
18
|
+
from dotenv import load_dotenv
|
|
19
|
+
from rich.progress import Progress, TimeElapsedColumn
|
|
20
|
+
|
|
21
|
+
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
load_dotenv()
|
|
26
|
+
try:
|
|
27
|
+
ACCESS_TOKEN = os.environ["ACCESS_TOKEN"]
|
|
28
|
+
API_URL = os.environ["API_URL"]
|
|
29
|
+
except KeyError as e:
|
|
30
|
+
logger.error(f"fatal: .env file or environment variables must be set. Missing: {e}")
|
|
31
|
+
sys.exit(1)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
BASE_URL = urljoin(API_URL, "processing")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _convert_time(seconds):
|
|
38
|
+
mins, secs = divmod(seconds, 60)
|
|
39
|
+
hours, mins = divmod(mins, 60)
|
|
40
|
+
return f"{hours:02.0f}:{mins:02.0f}:{secs:02.0f}"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _send_request(url, payload=None):
|
|
44
|
+
headers = {
|
|
45
|
+
"Authorization": f"Bearer {ACCESS_TOKEN}",
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
}
|
|
48
|
+
if payload:
|
|
49
|
+
response = requests.post(url, headers=headers, json=payload)
|
|
50
|
+
else:
|
|
51
|
+
response = requests.get(url, headers=headers)
|
|
52
|
+
response.raise_for_status()
|
|
53
|
+
return response.json()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_jobs():
|
|
57
|
+
url = f"{BASE_URL}/executables/tasks"
|
|
58
|
+
result = _send_request(url)
|
|
59
|
+
jobs = [(item["name"], item["executable"]) for item in result["items"]]
|
|
60
|
+
return jobs
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def run_talend_job(job_id):
|
|
64
|
+
url = f"{BASE_URL}/executions"
|
|
65
|
+
payload = {"executable": job_id}
|
|
66
|
+
result = _send_request(url, payload)
|
|
67
|
+
exec_id = result["executionId"]
|
|
68
|
+
return exec_id
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def get_execution_status(execution_id):
|
|
72
|
+
url = f"{BASE_URL}/executions/{execution_id}"
|
|
73
|
+
result = _send_request(url)
|
|
74
|
+
status = result["status"]
|
|
75
|
+
return status
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def run_console(job_id):
|
|
79
|
+
exec_id = run_talend_job(job_id)
|
|
80
|
+
columns = (*Progress.get_default_columns(), TimeElapsedColumn())
|
|
81
|
+
with Progress(*columns, transient=True) as progress:
|
|
82
|
+
task = progress.add_task("twiddling thumbs ", total=None)
|
|
83
|
+
while True:
|
|
84
|
+
status = get_execution_status(exec_id)
|
|
85
|
+
if status not in ("dispatching", "executing"):
|
|
86
|
+
return status
|
|
87
|
+
else:
|
|
88
|
+
time.sleep(5)
|
|
89
|
+
progress.advance(task)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def run_unnatended(job_id):
|
|
93
|
+
exec_id = run_talend_job(job_id)
|
|
94
|
+
while True:
|
|
95
|
+
status = get_execution_status(exec_id)
|
|
96
|
+
logger.info(
|
|
97
|
+
f"status: {status} ({datetime.now().strftime('%Y-%m-%d %H:%M:%S')})"
|
|
98
|
+
)
|
|
99
|
+
if status not in ("dispatching", "executing"):
|
|
100
|
+
return status
|
|
101
|
+
else:
|
|
102
|
+
time.sleep(10)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def main():
|
|
106
|
+
parser = argparse.ArgumentParser()
|
|
107
|
+
parser.add_argument(
|
|
108
|
+
"--wait",
|
|
109
|
+
action="store_true",
|
|
110
|
+
help="wait for task to complete and show status",
|
|
111
|
+
)
|
|
112
|
+
parser.add_argument(
|
|
113
|
+
"--job",
|
|
114
|
+
help="Talend ETL task name",
|
|
115
|
+
)
|
|
116
|
+
args = parser.parse_args()
|
|
117
|
+
job_name = args.job
|
|
118
|
+
wait_enabled = args.wait
|
|
119
|
+
jobs = get_jobs()
|
|
120
|
+
if job_name:
|
|
121
|
+
if job_name not in (job[0] for job in jobs):
|
|
122
|
+
sys.exit(f"Invalid ETL job: {job_name}")
|
|
123
|
+
job_id = next(job[1] for job in jobs if job[0] == job_name)
|
|
124
|
+
logger.info(f"\nExecuting job: '{job_name}' ....")
|
|
125
|
+
if wait_enabled:
|
|
126
|
+
start = time.time()
|
|
127
|
+
status = run_unnatended(job_id)
|
|
128
|
+
stop = time.time()
|
|
129
|
+
elapsed = _convert_time(stop - start)
|
|
130
|
+
logger.info(f"\nExecution of job '{job_name}' finished")
|
|
131
|
+
logger.info(f"status: '{status}' (time: {elapsed})")
|
|
132
|
+
else:
|
|
133
|
+
run_talend_job(job_id)
|
|
134
|
+
else:
|
|
135
|
+
try:
|
|
136
|
+
logger.info("\nAvailable ETL Jobs:")
|
|
137
|
+
logger.info("-------------------")
|
|
138
|
+
for num, job in enumerate(jobs, 1):
|
|
139
|
+
logger.info(f"{num}) {job[0]}")
|
|
140
|
+
job_number = input("\nSelect a job number to run: ")
|
|
141
|
+
try:
|
|
142
|
+
job_number = int(job_number)
|
|
143
|
+
if job_number > len(jobs):
|
|
144
|
+
raise ValueError()
|
|
145
|
+
except ValueError:
|
|
146
|
+
raise ValueError("Invalid job number!")
|
|
147
|
+
job_name, job_id = jobs[job_number - 1]
|
|
148
|
+
logger.info(f"\nExecuting job: {job_name} ({job_id})\n")
|
|
149
|
+
if wait_enabled:
|
|
150
|
+
start = time.time()
|
|
151
|
+
status = run_console(job_id)
|
|
152
|
+
stop = time.time()
|
|
153
|
+
elapsed = _convert_time(stop - start)
|
|
154
|
+
logger.info(
|
|
155
|
+
f"\nExecution finished with status: '{status}' (time: {elapsed})"
|
|
156
|
+
)
|
|
157
|
+
input("\nPress <Enter> to exit...")
|
|
158
|
+
else:
|
|
159
|
+
run_talend_job(job_id)
|
|
160
|
+
except (ValueError, KeyboardInterrupt) as e:
|
|
161
|
+
input(f"\n{e}\nPress <Enter> to exit...")
|
|
162
|
+
sys.exit()
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
if __name__ == "__main__":
|
|
166
|
+
main()
|