This commit is contained in:
Nicholas Koben Kao 2024-01-24 12:53:43 -08:00
parent b1e9bcc4e6
commit eb04f246a4
4 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import modal
from config import config
import os
import subprocess
from pprint import pprint
stub = modal.Stub()
@ -51,6 +52,8 @@ def download_model(volume_name, download_config):
status = {"status": "success"}
requests.post(callback_url, json={**status, **callback_body})
print(f"finished! sending to {callback_url}")
pprint({**status, **callback_body})
@stub.local_entrypoint()
@ -63,7 +66,11 @@ def simple_download():
except modal.exception.FunctionTimeoutError as e:
status = {"status": "failed", "error_logs": f"{str(e)}", "timeout": timeout}
requests.post(callback_url, json={**status, **callback_body})
print(f"finished! sending to {callback_url}")
pprint({**status, **callback_body})
except Exception as e:
status = {"status": "failed", "error_logs": str(e)}
requests.post(callback_url, json={**status, **callback_body})
print(f"finished! sending to {callback_url}")
pprint({**status, **callback_body})

View File

@ -19,6 +19,7 @@ export async function POST(request: Request) {
if (!data || error) return error;
const { checkpoint_id, error_log, status, folder_path } = data;
console.log( checkpoint_id, error_log, status, folder_path )
if (status === "success") {
await db

View File

@ -89,7 +89,7 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
</span>
{checkpoint.is_public ? (
<Badge variant="orange">Public</Badge>
<Badge variant="green">Public</Badge>
) : (
<Badge variant="orange">Private</Badge>
)}
@ -112,7 +112,7 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
},
cell: ({ row }) => {
return (
<Badge variant={row.original.status === "failed" ? "red" : "green"}>
<Badge variant={row.original.status === "failed" ? "red" : (row.original.status === "started" ? "yellow" : "green")}>
{row.original.status}
</Badge>
);

View File

@ -115,6 +115,7 @@ function getUrl(civitai_url: string) {
export const addCivitaiCheckpoint = withServerPromise(
async (data: z.infer<typeof addCivitaiCheckpointSchema>) => {
const { userId, orgId } = auth();
console.log("START")
console.log("1");
if (!data.civitai_url) return { error: "no civitai_url" };
@ -221,7 +222,7 @@ async function uploadCheckpoint(
volume_name: v.volume_name,
volume_id: v.id,
checkpoint_id: c.id,
callback_url: `${protocol}://${domain}/api/volume-updated`,
callback_url: `${protocol}://${domain}/api/volume-upload`,
upload_type: "checkpoint"
}),
},