[ 
https://issues.apache.org/jira/browse/YUNIKORN-2235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17793493#comment-17793493
 ] 

Xie YiFan edited comment on YUNIKORN-2235 at 12/6/23 3:38 AM:
--------------------------------------------------------------

I would like to implement as following pseudocode.

For /ws/v1/partition/\{partitionName}/applications/\{type}
 * hander.go

add new handle function getPartitionApplications
{code:java}
func getPartitionApplications(w http.ResponseWriter, r *http.Request) {
  ...
  validateApplicationType(appType) // must be one of running, rejected and 
completed
  pc.GetAppsByState(appType)
  ...
} {code}
 * partition.go

add new function GetAppsByState
{code:java}
func (pc *PartitionContext) GetAppsByState(state string) []string {
  switch state {
    case "running":
      return getAppsByState(state)
    case "rejected":
      return getRejectedAppsByState(state)
    case "completed":
      return getCompletedAppsByState(state)
}{code}
For /ws/v1/partition/\{partitionName}/application/\{applicationID}
 * handler.go

add new handle function getPartitionApplication
{code:java}
func getPartitionApplication(w http.ResponseWriter, r *http.Request) {
  ...
  partitionContext.GetApplication(application)
  ...
} {code}
 * partition.go

add new function GetApplication
{code:java}
func (pc *PartitionContext) GetApplication(appID string) *objects.Application {
  return pc.getApplication(appID)
} {code}
[~wilfreds] Would you mind give me some suggestions?


was (Author: yifan.stan):
I would like to implement as following pseudocode.

For /ws/v1/partition/\{partitionName}/applications/\{type}
 * hander.go

add new handle function getPartitionApplications
{code:java}
func getPartitionApplication(w http.ResponseWriter, r *http.Request) {
  ...
  validateApplicationType(appType) // must be one of running, rejected and 
completed
  pc.GetAppsByState(appType)
  ...
} {code}

 * partition.go

add new function GetAppsByState
{code:java}
func (pc *PartitionContext) GetAppsByState(state string) []string {
  switch state {
    case "running":
      return getAppsByState(state)
    case "rejected":
      return getRejectedAppsByState(state)
    case "completed":
      return getCompletedAppsByState(state)
}{code}

For /ws/v1/partition/\{partitionName}/application/\{applicationID}
 * handler.go

add new handle function getPartitionApplication
{code:java}
func getPartitionApplication(w http.ResponseWriter, r *http.Request) {
  ...
  partitionContext.GetApplication(application)
  ...
} {code}

 * partition.go

add new function GetApplication
{code:java}
func (pc *PartitionContext) GetApplication(appID string) *objects.Application {
  return pc.getApplication(appID)
} {code}

[~wilfreds] Would you mind give me some suggestions?

> Add new RESTful API for retrieving application
> ----------------------------------------------
>
>                 Key: YUNIKORN-2235
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-2235
>             Project: Apache YuniKorn
>          Issue Type: New Feature
>          Components: core - scheduler
>            Reporter: Xie YiFan
>            Assignee: Xie YiFan
>            Priority: Minor
>
> *Situation:*
> Currently, the path format of retrieving application is 
> /ws/v1/partition/\{partitionName}/queue/\{queueName}/application/\{appId}.
> We have to give 3 parameters (partitionName, queueName & appID) to fetch 
> application information. But one application can only be submitted to one 
> queue and PartitionContext stores all applications. It means that we can 
> fetch the target application without queue name.
> *Proposal:*
> As we have discussed in slack, we can add the following 2 RESTful API.
>  # /ws/v1/partition/\{partitionName}/applications/\{type} 
> aim to list applications IDs via the types: rejected, running and completed
>  # /ws/v1/partition/\{partitionName}/application/\{applicationID} 
> aim to retrieving one application object directly.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to