Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

job-history query returns all jobs regardless of page or page_size parameter #354

Open
lux4rd0 opened this issue Jun 12, 2024 · 7 comments

Comments

@lux4rd0
Copy link

lux4rd0 commented Jun 12, 2024

Hello! Loving this API!! I'm building a quick application to support some of my workflows, and I started running into issues when trying to manage the job history endpoint. No matter what I send to it - it returns all jobs. So that:

http://ai01.tylephony.com:8888/v1/generation/job-history?page=1&page_size=2

Still returns:

{
  "queue": [],
  "history": [
    {
      "job_id": "14fd735a-2bd2-47e3-9601-ae74b7458bca",
      "is_finished": true
    },
    {
      "job_id": "70dd1a4f-33a9-45f6-adb2-a15b7f28673d",
      "is_finished": true
    },
    {
      "job_id": "9a3209ca-f818-41ac-af5f-ee734b47e286",
      "is_finished": true
    },
    {
      "job_id": "5e817ed0-896b-4514-89dc-ec78ef852cbb",
      "is_finished": true
    },
    {
      "job_id": "81e5bfff-a4e9-4d37-8694-b72105be142a",
      "is_finished": true
    },
    {
      "job_id": "7ee5010f-5aee-494a-a994-f3f5c43e42f8",
      "is_finished": true
    },
    {
      "job_id": "fd150e73-e580-43ab-9997-c3f63507b437",
      "is_finished": true
    }
  ]
}

I was hoping that by sending different pages and page sizes, I could paginate dynamically, but it looks like I'll need to handle the full list myself. Do you know if this is a bug?

Running the latest release, v0.4.0.6, on Windows.

@mrhan1993
Copy link
Owner

paginate dynamically is supported only if it is started with the --presistent parameter.

@lux4rd0
Copy link
Author

lux4rd0 commented Jun 23, 2024

Thanks! Will try it out!

@lux4rd0 lux4rd0 closed this as completed Jun 23, 2024
@lux4rd0 lux4rd0 reopened this Jun 23, 2024
@lux4rd0
Copy link
Author

lux4rd0 commented Jun 23, 2024

Using "--persistent" as a flag removes all history from being displayed:

{
  "queue": [
    {
      "job_id": "4b1b9e6f-2fb9-40c8-8036-a38bfa5517d1",
      "is_finished": false
    },
    {
      "job_id": "4406adf6-ca38-40c4-b992-edf496c51dae",
      "is_finished": false
    },
    {
      "job_id": "0c58643d-3429-4cf9-8c51-74935b8c36c4",
      "is_finished": false
    },
    {
      "job_id": "c2d2c673-3dd5-42bb-abab-439bab40c4ef",
      "is_finished": false
    }
  ],
  "history": []
}

There should be jobs listed in this history JSON array.

@mrhan1993
Copy link
Owner

Recommend new project FooocusAPI to you

@BaiMoHan
Copy link
Contributor

BaiMoHan commented Aug 2, 2024

Using "--persistent" as a flag removes all history from being displayed:

{
  "queue": [
    {
      "job_id": "4b1b9e6f-2fb9-40c8-8036-a38bfa5517d1",
      "is_finished": false
    },
    {
      "job_id": "4406adf6-ca38-40c4-b992-edf496c51dae",
      "is_finished": false
    },
    {
      "job_id": "0c58643d-3429-4cf9-8c51-74935b8c36c4",
      "is_finished": false
    },
    {
      "job_id": "c2d2c673-3dd5-42bb-abab-439bab40c4ef",
      "is_finished": false
    }
  ],
  "history": []
}

There should be jobs listed in this history JSON array.

remove all? I cannot understand it. I started the server with the "--persistent" but no records in database.db

@mrhan1993
Copy link
Owner

mrhan1993 commented Aug 2, 2024

@BaiMoHan @lux4rd0 When '-- persistent' is not used, the history is just a list in memory that disappears after the program is closed. In fact, the current version does not have the logic to delete records from the database.

@BaiMoHan
Copy link
Contributor

BaiMoHan commented Aug 3, 2024

@BaiMoHan @lux4rd0 When '-- persistent' is not used, the history is just a list in memory that disappears after the program is closed. In fact, the current version does not have the logic to delete records from the database.

Yes, I have reviewed some code, but not all of it. I found some bugs when saving records to the database. I am trying to fix it. Maybe will open one issue/pr later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants