@@ -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.
107+ def __init__ (self , ctx : Context , path : str , pathinfo : str , / , ** attributes : Any ): ...
114108
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.
125-
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,41 +122,42 @@ 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
154134 ----------
155135 ctx : Context
156136 The context object containing the session and URL for API interactions
157- base : str
158- The base HTTP path for the collection endpoint
159- name : str
160- The collection name , by default "jobs"
137+ path : str
138+ The HTTP path component for the collection endpoint
139+ pathinfo : str
140+ The HTTP part of the path directed at a specific resource , by default "jobs"
161141 uid : str, optional
162- The field name used to uniquely identify records, by default "key "
142+ The field name used to uniquely identify records, by default "guid "
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
170150 ----------
171- base : str
172- The base HTTP path for the instance endpoint
173- uid : str
174- The unique identifier for the instance.
151+ path : str
152+ The HTTP path component for the collection endpoint
153+ pathinfo : str
154+ The HTTP part of the path directed at a specific resource
175155
176156 Returns
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,15 +291,19 @@ 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
318298 ----------
319299 ctx : Context
320- The context object containing the session and URL for API interactions
321- base : str
322- The base path associated with the instance.
300+ The context object containing the session and URL for API interactions.
301+ path : str
302+ The HTTP path component for the collection endpoint
303+ pathinfo : str
304+ The HTTP part of the path directed at a specific resource
305+ **attributes : dict
306+ Resource attributes passed
323307 """
324- super ().__init__ (ctx , ** kwargs )
325- self .jobs = Jobs (ctx , base )
308+ super ().__init__ (ctx , path , pathinfo , ** kwargs )
309+ self .jobs = Jobs (ctx , self . _path )
0 commit comments