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

Split up job data dimension #1050

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/custom_docker_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- docker-image: ./images/cache-indexer
image-tags: ghcr.io/spack/cache-indexer:0.0.3
- docker-image: ./analytics
image-tags: ghcr.io/spack/django:0.4.6
image-tags: ghcr.io/spack/django:0.5.0
- docker-image: ./images/ci-prune-buildcache
image-tags: ghcr.io/spack/ci-prune-buildcache:0.0.4
- docker-image: ./images/protected-publish
Expand Down
359 changes: 359 additions & 0 deletions analytics/analytics/core/migrations/0004_new_dimensional_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,359 @@
# Generated by Django 5.1.5 on 2025-01-21 19:22

import django.contrib.postgres.fields
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0003_jobdatadimension_gitlab_failure_reason_and_more"),
]

operations = [
migrations.CreateModel(
name="GitlabJobDataDimension",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("gitlab_runner_version", models.CharField(max_length=16)),
("ref", models.CharField(max_length=256)),
(
"tags",
django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=32),
default=list,
size=None,
),
),
("commit_id", models.PositiveBigIntegerField(null=True)),
(
"job_type",
models.CharField(
choices=[
("build", "Build"),
("generate", "Generate"),
("no-specs-to-rebuild", "No Specs to Rebuild"),
("rebuild-index", "Rebuild Index"),
("copy", "Copy"),
("unsupported-copy", "Unsupported Copy"),
("sign-pkgs", "Sign Packages"),
("protected-publish", "Protected Publish"),
],
max_length=19,
),
),
],
),
migrations.CreateModel(
name="JobResultDimension",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("status", models.CharField(max_length=32)),
("error_taxonomy", models.CharField(max_length=64, null=True)),
(
"unnecessary",
models.BooleanField(
db_comment="Whether this job has 'No need to rebuild' in its trace.",
default=False,
),
),
(
"job_type",
models.CharField(
choices=[
("build", "Build"),
("generate", "Generate"),
("no-specs-to-rebuild", "No Specs to Rebuild"),
("rebuild-index", "Rebuild Index"),
("copy", "Copy"),
("unsupported-copy", "Unsupported Copy"),
("sign-pkgs", "Sign Packages"),
("protected-publish", "Protected Publish"),
],
max_length=19,
),
),
(
"infrastructure_error",
models.GeneratedField(
db_persist=True,
expression=models.Q(
models.Q(
("status", "failed"),
models.Q(
(
"error_taxonomy__in",
[
"spack_error",
"build_error",
"concretization_error",
"module_not_found",
],
),
_negated=True,
),
models.Q(
("error_taxonomy", "failed_to_get_specs"),
("job_type", "rebuild-index"),
_negated=True,
),
)
),
help_text='Whether or not this job is an "infrastructure error", or a legitimate CI failure.',
output_field=models.BooleanField(),
),
),
(
"gitlab_failure_reason",
models.CharField(
help_text="The failure reason reported by GitLab",
max_length=256,
),
),
(
"job_exit_code",
models.IntegerField(
help_text="The exit code of the job reported by GitLab",
null=True,
),
),
],
),
migrations.CreateModel(
name="JobRetryDimension",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("is_retry", models.BooleanField()),
("is_manual_retry", models.BooleanField()),
("attempt_number", models.PositiveSmallIntegerField()),
("final_attempt", models.BooleanField()),
],
),
migrations.CreateModel(
name="SpackJobDataDimension",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("job_size", models.CharField(max_length=128, null=True)),
("stack", models.CharField(max_length=128, null=True)),
],
),
migrations.AlterField(
model_name="timerfact",
name="job",
field=models.PositiveBigIntegerField(),
),
migrations.AlterField(
model_name="timerphasefact",
name="job",
field=models.PositiveBigIntegerField(),
),
migrations.RemoveConstraint(
model_name="timerfact",
name="timer-fact-composite-key",
),
migrations.RemoveConstraint(
model_name="timerphasefact",
name="timerphase-fact-composite-key",
),
migrations.AddConstraint(
model_name="timerfact",
constraint=models.UniqueConstraint(
fields=("job", "date", "time", "timer_data", "package", "spec"),
name="timer-fact-composite-key",
),
),
migrations.AddConstraint(
model_name="timerphasefact",
constraint=models.UniqueConstraint(
fields=(
"job",
"date",
"time",
"timer_data",
"package",
"spec",
"phase",
),
name="timerphase-fact-composite-key",
),
),
migrations.AddConstraint(
model_name="gitlabjobdatadimension",
constraint=models.UniqueConstraint(
fields=(
"gitlab_runner_version",
"ref",
"tags",
"commit_id",
"job_type",
),
name="unique-gitlab-job-data",
),
),
migrations.AddConstraint(
model_name="jobresultdimension",
constraint=models.CheckConstraint(
condition=models.Q(
("status", "failed"),
("error_taxonomy__isnull", True),
_connector="OR",
),
name="error-taxonomy-only-on-failed-status",
),
),
migrations.AddConstraint(
model_name="jobretrydimension",
constraint=models.UniqueConstraint(
fields=(
"is_retry",
"is_manual_retry",
"attempt_number",
"final_attempt",
),
name="unique-retry-pairing",
),
),
migrations.AddConstraint(
model_name="spackjobdatadimension",
constraint=models.UniqueConstraint(
fields=("job_size", "stack"), name="unique-spack-job-data"
),
),
# Add new nulled (for now) foreign keys on job fact
migrations.AddField(
model_name="jobfact",
name="gitlab_job_data",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="core.gitlabjobdatadimension",
),
),
migrations.AddField(
model_name="jobfact",
name="job_result",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="core.jobresultdimension",
),
),
migrations.AddField(
model_name="jobfact",
name="job_retry",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="core.jobretrydimension",
),
),
migrations.AddField(
model_name="jobfact",
name="spack_job_data",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="core.spackjobdatadimension",
),
),
# Add new job fact fields
migrations.AddField(
model_name="jobfact",
name="job_url",
field=models.URLField(default=""),
preserve_default=False,
),
migrations.AddField(
model_name="jobfact",
name="name",
field=models.CharField(default="", max_length=128),
preserve_default=False,
),
migrations.AddField(
model_name="jobfact",
name="pod_name",
field=models.CharField(default="", max_length=128),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_after_script",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_cleanup_file_variables",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_download_artifacts",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_get_sources",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_prepare_executor",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_prepare_script",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_resolve_secrets",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_step_script",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_upload_artifacts_on_failure",
field=models.PositiveIntegerField(default=0),
),
migrations.AddField(
model_name="jobfact",
name="gitlab_upload_artifacts_on_success",
field=models.PositiveIntegerField(default=0),
),
]
Loading
Loading