Fooocus-API icon indicating copy to clipboard operation
Fooocus-API copied to clipboard

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

Open lux4rd0 opened this issue 1 year ago • 7 comments

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.

lux4rd0 avatar Jun 12 '24 16:06 lux4rd0

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

mrhan1993 avatar Jun 18 '24 01:06 mrhan1993

Thanks! Will try it out!

lux4rd0 avatar Jun 23 '24 14:06 lux4rd0

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.

lux4rd0 avatar Jun 23 '24 16:06 lux4rd0

Recommend new project FooocusAPI to you

mrhan1993 avatar Jul 04 '24 02:07 mrhan1993

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

BaiMoHan avatar Aug 02 '24 07:08 BaiMoHan

@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.

mrhan1993 avatar Aug 02 '24 17:08 mrhan1993

@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.

BaiMoHan avatar Aug 03 '24 08:08 BaiMoHan