datatailr 0.1.15__tar.gz → 0.1.16__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.

Potentially problematic release.


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

Files changed (38) hide show
  1. {datatailr-0.1.15/src/datatailr.egg-info → datatailr-0.1.16}/PKG-INFO +3 -3
  2. {datatailr-0.1.15 → datatailr-0.1.16}/README.md +2 -2
  3. {datatailr-0.1.15 → datatailr-0.1.16}/pyproject.toml +1 -1
  4. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/base.py +46 -10
  5. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/user.py +4 -3
  6. {datatailr-0.1.15 → datatailr-0.1.16/src/datatailr.egg-info}/PKG-INFO +3 -3
  7. {datatailr-0.1.15 → datatailr-0.1.16}/src/sbin/datatailr_run.py +4 -1
  8. {datatailr-0.1.15 → datatailr-0.1.16}/LICENSE +0 -0
  9. {datatailr-0.1.15 → datatailr-0.1.16}/setup.cfg +0 -0
  10. {datatailr-0.1.15 → datatailr-0.1.16}/setup.py +0 -0
  11. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/__init__.py +0 -0
  12. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/acl.py +0 -0
  13. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/blob.py +0 -0
  14. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/build/__init__.py +0 -0
  15. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/build/image.py +0 -0
  16. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/dt_json.py +0 -0
  17. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/errors.py +0 -0
  18. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/group.py +0 -0
  19. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/logging.py +0 -0
  20. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/__init__.py +0 -0
  21. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/arguments_cache.py +0 -0
  22. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/batch.py +0 -0
  23. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/batch_decorator.py +0 -0
  24. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/constants.py +0 -0
  25. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/schedule.py +0 -0
  26. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/scheduler/utils.py +0 -0
  27. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/utils.py +0 -0
  28. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/version.py +0 -0
  29. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr/wrapper.py +0 -0
  30. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr.egg-info/SOURCES.txt +0 -0
  31. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr.egg-info/dependency_links.txt +0 -0
  32. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr.egg-info/entry_points.txt +0 -0
  33. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr.egg-info/requires.txt +0 -0
  34. {datatailr-0.1.15 → datatailr-0.1.16}/src/datatailr.egg-info/top_level.txt +0 -0
  35. {datatailr-0.1.15 → datatailr-0.1.16}/src/sbin/datatailr_run_app.py +0 -0
  36. {datatailr-0.1.15 → datatailr-0.1.16}/src/sbin/datatailr_run_batch.py +0 -0
  37. {datatailr-0.1.15 → datatailr-0.1.16}/src/sbin/datatailr_run_excel.py +0 -0
  38. {datatailr-0.1.15 → datatailr-0.1.16}/src/sbin/datatailr_run_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datatailr
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: Ready-to-Use Platform That Drives Business Insights
5
5
  Author-email: Datatailr <info@datatailr.com>
6
6
  License-Expression: MIT
@@ -84,9 +84,9 @@ print(datatailr.__provider__)
84
84
  The following example shows how to create a simple data pipeline using the Datatailr Python package.
85
85
 
86
86
  ```python
87
- from datatailr.scheduler import batch, Batch
87
+ from datatailr.scheduler import batch_job, Batch
88
88
 
89
- @batch_job_job()
89
+ @batch_job()
90
90
  def func_no_args() -> str:
91
91
  return "no_args"
92
92
 
@@ -47,9 +47,9 @@ print(datatailr.__provider__)
47
47
  The following example shows how to create a simple data pipeline using the Datatailr Python package.
48
48
 
49
49
  ```python
50
- from datatailr.scheduler import batch, Batch
50
+ from datatailr.scheduler import batch_job, Batch
51
51
 
52
- @batch_job_job()
52
+ @batch_job()
53
53
  def func_no_args() -> str:
54
54
  return "no_args"
55
55
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "datatailr"
7
- version = "0.1.15"
7
+ version = "0.1.16"
8
8
  description = "Ready-to-Use Platform That Drives Business Insights"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -78,12 +78,6 @@ class Resources:
78
78
  cpu: float = DEFAULT_TASK_CPU
79
79
 
80
80
 
81
- # TODO: create a dt_run script that will:
82
- # 1. create user and group if not exists
83
- # 2. set the correct path
84
- # 3. run the job based on its type
85
-
86
-
87
81
  class EntryPoint:
88
82
  """
89
83
  Represents an entry point for a DataTailr job.
@@ -144,7 +138,7 @@ class Job:
144
138
  python_requirements: str = "",
145
139
  build_script_pre: str = "",
146
140
  build_script_post: str = "",
147
- type: JobType = JobType.UNKNOWN,
141
+ type: Optional[JobType] = JobType.UNKNOWN,
148
142
  entrypoint: Optional[EntryPoint] = None,
149
143
  update_existing: bool = False,
150
144
  ):
@@ -178,7 +172,7 @@ class Job:
178
172
  build_script_post=build_script_post,
179
173
  )
180
174
  self.image = image
181
- self.type = type
175
+ self.type = type if entrypoint is None else entrypoint.type
182
176
  self.entrypoint = entrypoint
183
177
  self.__id = str(uuid.uuid4())
184
178
 
@@ -338,6 +332,8 @@ class Job:
338
332
  __client__.run(f"file://{temp_file_name}", **self.get_schedule_args())
339
333
  elif command == "save":
340
334
  __client__.save(f"file://{temp_file_name}", **self.get_schedule_args())
335
+ elif command == "start":
336
+ __client__.start(self.name, environment=self.environment)
341
337
  else:
342
338
  raise ValueError(f"Unknown command: {command}")
343
339
  os.remove(temp_file_name)
@@ -350,12 +346,52 @@ class Job:
350
346
  """
351
347
  Save the job to the DataTailr platform.
352
348
  If the job already exists, it will be updated.
349
+ The repository state is verified and an image is prepared for execution.
353
350
  """
354
351
  return self.__run_command__("save")
355
352
 
356
353
  def run(self) -> Tuple[bool, str]:
357
354
  """
358
- Run the job. This method should be implemented to execute the job logic.
359
- It verifies the repository state and prepares the job for execution.
355
+ Run the job.
356
+ This is equivalent to running job.save() and then job.start().
360
357
  """
361
358
  return self.__run_command__("run")
359
+
360
+ def start(self) -> Tuple[bool, str]:
361
+ """
362
+ Start the job. This will start the job execution on a schedule for batches if a schedule was specified.
363
+ For other types of jobs and for batches without a schedule the job will be run immediately.
364
+ """
365
+ return self.__run_command__("start")
366
+
367
+ def promote(
368
+ self,
369
+ from_environment: Optional[Environment] = None,
370
+ version: Optional[str | int] = None,
371
+ ) -> Tuple[bool, str]:
372
+ """
373
+ Promote the job to the next environment.
374
+ This method is used to promote a version of the job from one environment to the next one.
375
+ If none of the environments to promote from are specified, it defaults to promote from all environments.
376
+ """
377
+ promote_kwargs = {}
378
+ if version is not None:
379
+ promote_kwargs["version"] = str(version)
380
+ if from_environment is not None:
381
+ promote_kwargs["environment"] = str(from_environment)
382
+ try:
383
+ __client__.promote(self.name, **promote_kwargs)
384
+ return True, f"Job '{self.name}' promoted successfully."
385
+ except Exception as e:
386
+ logger.error(f"Error promoting job '{self.name}': {e}")
387
+ return False, str(e)
388
+
389
+ def versions(self, environment: Optional[Environment] = None) -> list[str] | None:
390
+ """
391
+ List all versions of the job in the specified environment.
392
+ If no environment is specified, it lists versions across all environments.
393
+ """
394
+ command_kwargs = {}
395
+ if environment is not None:
396
+ command_kwargs["environment"] = str(environment)
397
+ return __client__.versions(self.name, **command_kwargs)
@@ -170,7 +170,7 @@ class User:
170
170
  raise Warning(
171
171
  "Password is not required for system users. It will be ignored."
172
172
  )
173
- User.__client__.add(
173
+ new_user = __client__.add(
174
174
  name,
175
175
  first_name=first_name,
176
176
  last_name=last_name,
@@ -179,7 +179,7 @@ class User:
179
179
  system=is_system_user,
180
180
  )
181
181
  else:
182
- __client__.add(
182
+ new_user = __client__.add(
183
183
  name,
184
184
  first_name=first_name,
185
185
  last_name=last_name,
@@ -188,7 +188,8 @@ class User:
188
188
  primary_group=primary_group,
189
189
  system=is_system_user,
190
190
  )
191
- return User.get(name)
191
+
192
+ return new_user
192
193
 
193
194
  @staticmethod
194
195
  def exists(name: str) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datatailr
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: Ready-to-Use Platform That Drives Business Insights
5
5
  Author-email: Datatailr <info@datatailr.com>
6
6
  License-Expression: MIT
@@ -84,9 +84,9 @@ print(datatailr.__provider__)
84
84
  The following example shows how to create a simple data pipeline using the Datatailr Python package.
85
85
 
86
86
  ```python
87
- from datatailr.scheduler import batch, Batch
87
+ from datatailr.scheduler import batch_job, Batch
88
88
 
89
- @batch_job_job()
89
+ @batch_job()
90
90
  def func_no_args() -> str:
91
91
  return "no_args"
92
92
 
@@ -94,7 +94,6 @@ def main():
94
94
 
95
95
  job_name = get_env_var("DATATAILR_JOB_NAME")
96
96
  job_id = get_env_var("DATATAILR_JOB_ID")
97
- entrypoint = get_env_var("DATATAILR_ENTRYPOINT")
98
97
 
99
98
  if job_type == "batch":
100
99
  run_id = get_env_var("DATATAILR_BATCH_RUN_ID")
@@ -102,6 +101,7 @@ def main():
102
101
  job_argument_mapping = get_env_var(
103
102
  "DATATAILR_JOB_ARGUMENT_MAPPING", encode_json({})
104
103
  )
104
+ entrypoint = get_env_var("DATATAILR_BATCH_ENTRYPOINT")
105
105
  env = {
106
106
  "DATATAILR_BATCH_RUN_ID": run_id,
107
107
  "DATATAILR_BATCH_ID": batch_id,
@@ -112,6 +112,7 @@ def main():
112
112
  run_command_as_user("datatailr_run_batch", user, env)
113
113
  elif job_type == "service":
114
114
  port = get_env_var("DATATAILR_SERVICE_PORT")
115
+ entrypoint = get_env_var("DATATAILR_ENTRYPOINT")
115
116
  env = {
116
117
  "DATATAILR_JOB_NAME": job_name,
117
118
  "DATATAILR_JOB_ID": job_id,
@@ -120,6 +121,7 @@ def main():
120
121
  }
121
122
  run_command_as_user("datatailr_run_service", user, env)
122
123
  elif job_type == "app":
124
+ entrypoint = get_env_var("DATATAILR_ENTRYPOINT")
123
125
  env = {
124
126
  "DATATAILR_JOB_NAME": job_name,
125
127
  "DATATAILR_JOB_ID": job_id,
@@ -128,6 +130,7 @@ def main():
128
130
  run_command_as_user("datatailr_run_app", user, env)
129
131
  elif job_type == "excel":
130
132
  host = get_env_var("DATATAILR_HOST")
133
+ entrypoint = get_env_var("DATATAILR_ENTRYPOINT")
131
134
  env = {
132
135
  "DATATAILR_JOB_NAME": job_name,
133
136
  "DATATAILR_JOB_ID": job_id,
File without changes
File without changes
File without changes