Coverage for /builds/BuildGrid/buildgrid/buildgrid/server/sql/alembic/versions/38b36022308b_add_worker_partial_execution_timestamps.py: 69.57%

23 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-12-05 10:15 +0000

1# Copyright (C) 2024 Bloomberg LP 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# <http://www.apache.org/licenses/LICENSE-2.0> 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15"""Add worker partial execution timestamps 

16 

17Revision ID: 38b36022308b 

18Revises: b5563d55f4e3 

19Create Date: 2024-10-25 17:04:49.469210 

20 

21""" 

22import sqlalchemy as sa 

23from alembic import op 

24 

25# revision identifiers, used by Alembic. 

26revision = "38b36022308b" 

27down_revision = "b5563d55f4e3" 

28branch_labels = None 

29depends_on = None 

30 

31 

32def upgrade() -> None: 

33 with op.batch_alter_table("jobs") as batch_op: 

34 batch_op.add_column(sa.Column("input_fetch_start_timestamp", sa.DateTime(), nullable=True)) 

35 batch_op.add_column(sa.Column("input_fetch_completed_timestamp", sa.DateTime(), nullable=True)) 

36 batch_op.add_column(sa.Column("output_upload_start_timestamp", sa.DateTime(), nullable=True)) 

37 batch_op.add_column(sa.Column("output_upload_completed_timestamp", sa.DateTime(), nullable=True)) 

38 batch_op.add_column(sa.Column("execution_start_timestamp", sa.DateTime(), nullable=True)) 

39 batch_op.add_column(sa.Column("execution_completed_timestamp", sa.DateTime(), nullable=True)) 

40 

41 

42def downgrade() -> None: 

43 with op.batch_alter_table("jobs") as batch_op: 

44 batch_op.drop_column("execution_completed_timestamp") 

45 batch_op.drop_column("execution_start_timestamp") 

46 batch_op.drop_column("output_upload_completed_timestamp") 

47 batch_op.drop_column("output_upload_start_timestamp") 

48 batch_op.drop_column("input_fetch_completed_timestamp") 

49 batch_op.drop_column("input_fetch_start_timestamp")