tinybird 0.0.1.dev181__py3-none-any.whl → 0.0.1.dev182__py3-none-any.whl

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.

Potentially problematic release.


This version of tinybird might be problematic. Click here for more details.

tinybird/tb/__cli__.py CHANGED
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev181'
8
- __revision__ = '0bfd0e2'
7
+ __version__ = '0.0.1.dev182'
8
+ __revision__ = 'b1eeede'
tinybird/tb/client.py CHANGED
@@ -4,7 +4,7 @@ import logging
4
4
  import os
5
5
  import ssl
6
6
  from pathlib import Path
7
- from typing import Any, Callable, Dict, List, Mapping, Optional, Set, Union
7
+ from typing import Any, Callable, Dict, List, Mapping, Optional, Set, Tuple, Union
8
8
  from urllib.parse import quote, urlencode
9
9
 
10
10
  import aiofiles
@@ -696,12 +696,30 @@ class TinyB:
696
696
  else:
697
697
  return await self._req(f"/v0/sql?q={quote(sql, safe='')}&{urlencode(params)}")
698
698
 
699
- async def jobs(self, status=None):
700
- jobs = (await self._req("/v0/jobs"))["jobs"]
701
- if status:
702
- status = [status] if isinstance(status, str) else status
703
- jobs = [j for j in jobs if j["status"] in status]
704
- return jobs
699
+ async def jobs(
700
+ self, status: Optional[Tuple[str, ...]] = None, kind: Optional[Tuple[str, ...]] = None
701
+ ) -> List[Dict[str, Any]]:
702
+ async def fetch_jobs(params: Dict[str, str]) -> List[Dict[str, Any]]:
703
+ query_string = urlencode(params) if params else ""
704
+ endpoint = f"/v0/jobs?{query_string}" if query_string else "/v0/jobs"
705
+ response = await self._req(endpoint)
706
+ return response["jobs"]
707
+
708
+ if not status and not kind:
709
+ return await fetch_jobs({})
710
+ result: List[Dict[str, Any]] = []
711
+ if status and kind:
712
+ for s in status:
713
+ for k in kind:
714
+ result.extend(await fetch_jobs({"status": s, "kind": k}))
715
+ elif status:
716
+ for s in status:
717
+ result.extend(await fetch_jobs({"status": s}))
718
+ elif kind:
719
+ for k in kind:
720
+ result.extend(await fetch_jobs({"kind": k}))
721
+
722
+ return result
705
723
 
706
724
  async def job(self, job_id: str):
707
725
  return await self._req(f"/v0/jobs/{job_id}")
@@ -87,7 +87,7 @@ async def new_ds(
87
87
  if datasource.get("service") == "dynamodb":
88
88
  job_id = datasource_response.get("import_id", None)
89
89
  if job_id:
90
- jobs = await client.jobs(status=["waiting", "working"])
90
+ jobs = await client.jobs(status=("waiting", "working"))
91
91
  job_url = next((job["job_url"] for job in jobs if job["id"] == job_id), None)
92
92
  if job_url:
93
93
  click.echo(FeedbackManager.success_dynamodb_initial_load(job_url=job_url))
@@ -3,6 +3,8 @@
3
3
  # - If it makes sense and only when strictly necessary, you can create utility functions in this file.
4
4
  # - But please, **do not** interleave utility functions and command definitions.
5
5
 
6
+ from typing import Tuple
7
+
6
8
  import click
7
9
  from click import Context
8
10
 
@@ -24,16 +26,23 @@ def job(ctx: Context) -> None:
24
26
  "-s",
25
27
  "--status",
26
28
  help="Show only jobs with this status",
27
- type=click.Choice(["waiting", "working", "done", "error"], case_sensitive=False),
29
+ type=click.Choice(["waiting", "working", "done", "error", "cancelling", "cancelled"], case_sensitive=False),
30
+ multiple=True,
31
+ default=None,
32
+ )
33
+ @click.option(
34
+ "-k",
35
+ "--kind",
36
+ help="Show only jobs of this kind",
28
37
  multiple=True,
29
38
  default=None,
30
39
  )
31
40
  @click.pass_context
32
41
  @coro
33
- async def jobs_ls(ctx: Context, status: str) -> None:
34
- """List jobs, up to 100 in the last 48h"""
42
+ async def jobs_ls(ctx: Context, status: Tuple[str, ...], kind: Tuple[str, ...]) -> None:
43
+ """List jobs, up to 100"""
35
44
  client: TinyB = ctx.ensure_object(dict)["client"]
36
- jobs = await client.jobs(status=status)
45
+ jobs = await client.jobs(status=status, kind=kind)
37
46
  columns = ["id", "kind", "status", "created at", "updated at", "job url"]
38
47
  click.echo(FeedbackManager.info_jobs())
39
48
  table = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev181
3
+ Version: 0.0.1.dev182
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -12,10 +12,10 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
12
12
  tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
13
13
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
14
14
  tinybird/ch_utils/engine.py,sha256=X4tE9OrfaUy6kO9cqVEzyI9cDcmOF3IAssRRzsTsfEQ,40781
15
- tinybird/tb/__cli__.py,sha256=8iTlE27daJeiOAX4_hsaWWMEON1KBeHGMIVXpVUdIBQ,247
15
+ tinybird/tb/__cli__.py,sha256=Hcpk55aD10v-3_hprG0jGUy2hJWHo_jTD4ohLxO7jIs,247
16
16
  tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
17
17
  tinybird/tb/cli.py,sha256=u3eGOhX0MHkuT6tiwaZ0_3twqLmqKXDAOxF7yV_Nn9Q,1075
18
- tinybird/tb/client.py,sha256=QOGhsppeY5J5t0_buigAZ1U8Lmg9Hp-cVg6_wtOyjVI,55844
18
+ tinybird/tb/client.py,sha256=59GH0IoYSV_KUG0eEbDDYHSWH4OlkVnSRFXE3mYAM0s,56571
19
19
  tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
20
20
  tinybird/tb/modules/build.py,sha256=rRL5XKBdadMc9uVDEUt0GXm0h09Y6XXw199rdmRI1qo,19127
21
21
  tinybird/tb/modules/cicd.py,sha256=MnShTTJzKBYeajswF2jg7p7ZzupaeCgSriAN05MeEdg,7330
@@ -34,7 +34,7 @@ tinybird/tb/modules/exceptions.py,sha256=5jK91w1LPmtqIUfDpHe_Op5OxGz8-p1BPgtLREM
34
34
  tinybird/tb/modules/feedback_manager.py,sha256=c0ZOpG7IHFq3doodezctX64cTcTquIOhO38w9uPuU8Q,76798
35
35
  tinybird/tb/modules/info.py,sha256=iKeFbFkos7vYaBU7Vr5SI-fa1x7AbuUHB748jsGsaA4,5944
36
36
  tinybird/tb/modules/infra.py,sha256=fve30Gj3mG9zbquGxS2e4ipcOYOxviWQCpNFfEzJN_Q,33195
37
- tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,2966
37
+ tinybird/tb/modules/job.py,sha256=AsUCRNzy7HG5oJ4fyk9NpIm5NtNJgBZSy8MtJdXBe5A,3167
38
38
  tinybird/tb/modules/llm.py,sha256=KfsCYmKeW1VQz0iDZhGKCRkQv_Y3kTHh6JuxvofOguE,1076
39
39
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
40
40
  tinybird/tb/modules/local.py,sha256=SUaGWH9TLDFFF9uCw4y7UW4NsKgnXG8uxTcxz1dbkCM,14230
@@ -58,7 +58,7 @@ tinybird/tb/modules/workspace.py,sha256=-XUvL2PB5GcviJ8m30h-ZDc5kwJcm1wy1dreYa2l
58
58
  tinybird/tb/modules/workspace_members.py,sha256=RYLpyPM1ECCasHRg3uvpckzXplX0_KgNFsSPZn_i6qk,8744
59
59
  tinybird/tb/modules/datafile/build.py,sha256=d_h3pRFDPFrDKGhpFx2iejY25GuB2k8yfNouj6s8caw,50973
60
60
  tinybird/tb/modules/datafile/build_common.py,sha256=LU24kAQmxDJIyoIapDaYG-SU3P4FrMG9UBf8m9PgVSI,4565
61
- tinybird/tb/modules/datafile/build_datasource.py,sha256=nXEQ0qHdq2ai7jJTv8H2d7eeDPBYzLn8VY7zMtOYb8M,17382
61
+ tinybird/tb/modules/datafile/build_datasource.py,sha256=y4WVe_d2h9zqs7jAzPsUOOCqBaMAvmRQX5oHPJfTV4Y,17382
62
62
  tinybird/tb/modules/datafile/build_pipe.py,sha256=6Cwjf3BKEF3-oQ9PipsQfK-Z43nSwtA4qJAUoysI7Uc,11385
63
63
  tinybird/tb/modules/datafile/common.py,sha256=9mZqagXTjw6XXdNBvTWv_jQDaLIwNBmKAd6VxhxRuVo,91721
64
64
  tinybird/tb/modules/datafile/diff.py,sha256=MTmj53RYjER4neLgWVjabn-FKVFgh8h8uYiBo55lFQg,6757
@@ -80,8 +80,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
80
80
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
81
81
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
82
82
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
83
- tinybird-0.0.1.dev181.dist-info/METADATA,sha256=O18GXI84iGtB6bfQS-DeCKWRwrteeTp8JI_t-UOST4k,1608
84
- tinybird-0.0.1.dev181.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev181.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev181.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev181.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev182.dist-info/METADATA,sha256=CcRyE9gi46a71FVojswEwM9vjvsZsMN8hqOcS5DuSh8,1608
84
+ tinybird-0.0.1.dev182.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev182.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev182.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev182.dist-info/RECORD,,