Closed IceKhan13 closed 2 months ago
Do you need help with this, @IceKhan13 ?
Yes, I'm pretty busy in next few days. If somebody can take it during this time, it will be great!
@IceKhan13 Are the values below instead of "user" or "providers" ?
PRE_FILTER_KEYWORD: str = "catalog"
PRE_FILTER_KEYWORD: str = "serverless"
This is the snippet of job client. This needs some changes, doesn't it?
def list(self, **kwargs) -> List["Job"]:
tracer = trace.get_tracer("client.tracer")
with tracer.start_as_current_span("job.list"):
limit = kwargs.get("limit", 10)
offset = kwargs.get("offset", 0)
response_data = safe_json_request(
request=lambda: requests.get(
f"{self.host}/api/{self.version}/jobs/?limit={limit}&offset={offset}",
headers={"Authorization": f"Bearer {self._token}"},
timeout=REQUESTS_TIMEOUT,
)
)
return [
Job(job.get("id"), job_client=self, raw_data=job)
for job in response_data.get("results", [])
]
The /programs
looks good.
def get_programs(self, **kwargs):
@IceKhan13 Are the values below instead of "user" or "providers" ?
PRE_FILTER_KEYWORD: str = "catalog" PRE_FILTER_KEYWORD: str = "serverless"
Open to discuss but I would not attach the client to the end-point. If other client would like to retrieve user
or partner
would need to use catalog
or serverless
. I would maintain Iskandar approach here.
user for /programs?filter=user will return function uploaded by this user only
I believe that this is the current behavior without the filter, right? @IceKhan13 @Tansito
I believe that this is the current behavior without the filter, right? @IceKhan13 @Tansito
I would say the logic changes a little bit:
That way user
always returns user functions and provider
always returns provider functions. And if there is no filter I would do what we are basically doing right now: user == author && VIEW_PERMISSION
What is the expected behavior?
We want to have/v1/jobs?filter=).
jobs
andprograms
endpoints to have additional filtering parameter (https://Initially we need only 2 filters (names might change):
providers
/programs?filter=providers
will return function uploaded by providers only/jobs?filter=providers
will return only user jobs associated with providers onlyuser
/programs?filter=user
will return function uploaded by this user only/jobs?filter=user
will return only user jobs associated with only user programs2 filters above are mutually exclusive.