@@ -101,34 +101,13 @@ class _Job(TypedDict):
101101 """A tag categorizing the job type. Options are build_jupyter, build_report, build_site, configure_report, git, packrat_restore, python_restore, render_shiny, run_api, run_app, run_bokeh_app, run_dash_app, run_fastapi_app, run_pyshiny_app, run_python_api, run_streamlit, run_tensorflow, run_voila_app, testing, unknown, val_py_ext_pkg, val_r_ext_pkg, and val_r_install."""
102102
103103 @overload
104- def __init__ (self , ctx : Context , base : str , uid : str , / , ** attributes : Unpack [_Job ]):
105- ...
104+ def __init__ (self , ctx : Context , path : str , pathinfo : str , / , ** attributes : Unpack [_Job ]): ...
106105
107106 @overload
108- def __init__ (self , ctx : Context , base : str , uid : str , / , ** attributes : Any ): ...
109-
110- def __init__ (self , ctx : Context , base : str , uid : str , / , ** attributes : Any ):
111- """A Job.
112-
113- A Job represents single execution instance of Content on Connect. Whenever Content runs, whether it's a scheduled report, a script execution, or server processes related to an application, a Job is created to manage and encapsulate that execution.
114-
115- Parameters
116- ----------
117- ctx : Context
118- The context object containing the session and URL for API interactions.
119- base : str
120- The base HTTP path for the Job endpoint (e.g., '/jobs')
121- uid : str
122- The unique identifier
123- **attributes
124- Object items passed to the base resource dictionary.
107+ def __init__ (self , ctx : Context , path : str , pathinfo : str , / , ** attributes : Any ): ...
125108
126- Notes
127- -----
128- A Job is a reference to a server process on Connect, it is not the process itself. Jobs are executed asynchronously.
129- """
130- super ().__init__ (ctx , ** attributes )
131- self ._endpoint = ctx .url + base + uid
109+ def __init__ (self , ctx : Context , path : str , pathinfo : str , / , ** attributes : Any ):
110+ super ().__init__ (ctx , path , pathinfo , ** attributes )
132111
133112 def destroy (self ) -> None :
134113 """Destroy the job.
@@ -143,11 +122,12 @@ def destroy(self) -> None:
143122 ----
144123 This action requires administrator, owner, or collaborator privileges.
145124 """
146- self ._ctx .session .delete (self ._endpoint )
125+ endpoint = self ._ctx .url + self ._path
126+ self ._ctx .session .delete (endpoint )
147127
148128
149129class Jobs (ActiveFinderMethods [Job ], ActiveSequence [Job ]):
150- def __init__ (self , ctx : Context , base : str , path : str = "jobs" , uid = "key" ):
130+ def __init__ (self , ctx : Context , path : str , pathinfo : str = "jobs" , uid : str = "key" ):
151131 """A collection of jobs.
152132
153133 Parameters
@@ -161,9 +141,9 @@ def __init__(self, ctx: Context, base: str, path: str = "jobs", uid="key"):
161141 uid : str, optional
162142 The field name used to uniquely identify records, by default "key"
163143 """
164- super ().__init__ (ctx , base , path , uid )
144+ super ().__init__ (ctx , path , pathinfo , uid )
165145
166- def _create_instance (self , base : str , uid : str , ** kwargs : Any ) -> Job :
146+ def _create_instance (self , path : str , pathinfo : str , ** kwargs : Any ) -> Job :
167147 """Creates a Job instance.
168148
169149 Parameters
@@ -177,7 +157,7 @@ def _create_instance(self, base: str, uid: str, **kwargs: Any) -> Job:
177157 -------
178158 Job
179159 """
180- return Job (self ._ctx , base , uid , ** kwargs )
160+ return Job (self ._ctx , path , pathinfo , ** kwargs )
181161
182162 class _FindByRequest (TypedDict , total = False ):
183163 # Identifiers
@@ -311,7 +291,7 @@ def find_by(self, **conditions) -> Optional[Job]:
311291class JobsMixin (Active , Resource ):
312292 """Mixin class to add a jobs attribute to a resource."""
313293
314- def __init__ (self , ctx : Context , base : str , / , ** kwargs ):
294+ def __init__ (self , ctx , path , pathinfo = "" , / , ** kwargs ):
315295 """Mixin class which adds a `jobs` attribute to the Active Resource.
316296
317297 Parameters
@@ -321,5 +301,5 @@ def __init__(self, ctx: Context, base: str, /, **kwargs):
321301 base : str
322302 The base path associated with the instance.
323303 """
324- super ().__init__ (ctx , ** kwargs )
325- self .jobs = Jobs (ctx , base )
304+ super ().__init__ (ctx , path , pathinfo , ** kwargs )
305+ self .jobs = Jobs (ctx , self . _path )
0 commit comments