# Generated by Django 4.2.7 on 2026-01-28 03:16

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("workflow_explorer", "0005_workitem_bandstructurecalc_run_id_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="SimmateWorker",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("status", models.CharField(blank=True, max_length=10, null=True)),
                ("shutdown_flag", models.BooleanField(default=False)),
                ("ncores", models.FloatField(blank=True, null=True)),
                ("ram", models.FloatField(blank=True, null=True)),
                (
                    "computer_system",
                    models.CharField(blank=True, max_length=75, null=True),
                ),
                ("directory", models.CharField(blank=True, max_length=250, null=True)),
                ("tags", models.JSONField(default=list)),
                ("nitems_max", models.IntegerField(blank=True, null=True)),
                ("timeout", models.FloatField(blank=True, null=True)),
                ("close_on_empty_queue", models.BooleanField(default=False)),
                ("waittime_on_empty_queue", models.FloatField(default=15)),
                ("startup_method", models.TextField(blank=True, null=True)),
                ("nitems_completed", models.IntegerField(blank=True, null=True)),
                ("total_up_time", models.FloatField(blank=True, null=True)),
                ("total_workflow_time", models.FloatField(blank=True, null=True)),
                ("idle_percent", models.FloatField(blank=True, null=True)),
                (
                    "owner",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="workers",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "db_table": "workflow_engine__workers",
            },
        ),
        migrations.AddField(
            model_name="workitem",
            name="worker",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="work_items",
                to="workflow_explorer.simmateworker",
            ),
        ),
    ]
