Merge pull request #72546 from ClickHouse/test-local-module

Improve praktika imports
This commit is contained in:
Mikhail f. Shiryaev 2024-11-27 17:45:07 +00:00 committed by GitHub
commit ed1f326d56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 116 additions and 109 deletions

View File

@ -3,3 +3,5 @@ from .docker import Docker
from .job import Job
from .secret import Secret
from .workflow import Workflow
__all__ = ["Artifact", "Docker", "Job", "Secret", "Workflow"]

View File

@ -1,10 +1,10 @@
import argparse
import sys
from praktika.html_prepare import Html
from praktika.utils import Utils
from praktika.validator import Validator
from praktika.yaml_generator import YamlGenerator
from .html_prepare import Html
from .utils import Utils
from .validator import Validator
from .yaml_generator import YamlGenerator
def create_parser():
@ -86,8 +86,8 @@ def main():
elif args.command == "html":
Html.prepare()
elif args.command == "run":
from praktika.mangle import _get_workflows
from praktika.runner import Runner
from .mangle import _get_workflows
from .runner import Runner
workflows = _get_workflows(name=args.workflow or None)
job_workflow_pairs = []

View File

@ -5,9 +5,9 @@ from pathlib import Path
from types import SimpleNamespace
from typing import Any, Dict, List, Type
from praktika import Workflow
from praktika.settings import Settings
from praktika.utils import MetaClasses, T
from . import Workflow
from .settings import Settings
from .utils import MetaClasses, T
@dataclasses.dataclass

View File

@ -2,12 +2,12 @@ import dataclasses
import json
from pathlib import Path
from praktika import Artifact, Job, Workflow
from praktika._environment import _Environment
from praktika.digest import Digest
from praktika.s3 import S3
from praktika.settings import Settings
from praktika.utils import Utils
from . import Artifact, Job, Workflow
from ._environment import _Environment
from .digest import Digest
from .s3 import S3
from .settings import Settings
from .utils import Utils
class Cache:

View File

@ -4,10 +4,11 @@ import json
from typing import Optional
import requests
from praktika._environment import _Environment
from praktika.result import Result
from praktika.settings import Settings
from praktika.utils import Utils
from ._environment import _Environment
from .result import Result
from .settings import Settings
from .utils import Utils
class CIDB:

View File

@ -5,10 +5,10 @@ from hashlib import md5
from pathlib import Path
from typing import List
from praktika import Job
from praktika.docker import Docker
from praktika.settings import Settings
from praktika.utils import Utils
from . import Job
from .docker import Docker
from .settings import Settings
from .utils import Utils
class Digest:

View File

@ -1,7 +1,7 @@
import dataclasses
from typing import List
from praktika.utils import Shell
from .utils import Shell
class Docker:

View File

@ -0,0 +1 @@
#!/usr/bin/env python

View File

@ -1,4 +1,4 @@
from praktika.execution.machine_init import run
from .machine_init import run
if __name__ == "__main__":
run()

View File

@ -1,6 +1,6 @@
import os
from praktika.utils import MetaClasses
from ..utils import MetaClasses
class ScalingType(metaclass=MetaClasses.WithIter):

View File

@ -5,8 +5,9 @@ import time
import traceback
import requests
from praktika.execution.execution_settings import ExecutionSettings, ScalingType
from praktika.utils import ContextManager, Shell
from ..utils import ContextManager, Shell
from .execution_settings import ExecutionSettings, ScalingType
class StateMachine:

View File

@ -1,10 +1,10 @@
import json
import time
from praktika._environment import _Environment
from praktika.result import Result
from praktika.settings import Settings
from praktika.utils import Shell
from ._environment import _Environment
from .result import Result
from .settings import Settings
from .utils import Shell
class GH:

View File

@ -4,12 +4,14 @@ from typing import List
import requests
from jwt import JWT, jwk_from_pem
from praktika import Workflow
from praktika.mangle import _get_workflows
from praktika.settings import Settings
from praktika.utils import Shell
from . import Workflow
from .mangle import _get_workflows
from .settings import Settings
from .utils import Shell
# XXX: dead code with a bug in return installations[0]["id"] and using legacy jwt module
class GHAuth:
@staticmethod
def _generate_jwt(client_id, pem):

View File

@ -1,8 +1,8 @@
from praktika._environment import _Environment
from praktika.cache import Cache
from praktika.runtime import RunConfig
from praktika.settings import Settings
from praktika.utils import Utils
from ._environment import _Environment
from .cache import Cache
from .runtime import RunConfig
from .settings import Settings
from .utils import Utils
class CacheRunnerHooks:

View File

@ -3,14 +3,14 @@ import json
from pathlib import Path
from typing import List
from praktika._environment import _Environment
from praktika.gh import GH
from praktika.parser import WorkflowConfigParser
from praktika.result import Result, ResultInfo, _ResultS3
from praktika.runtime import RunConfig
from praktika.s3 import S3
from praktika.settings import Settings
from praktika.utils import Utils
from ._environment import _Environment
from .gh import GH
from .parser import WorkflowConfigParser
from .result import Result, ResultInfo, _ResultS3
from .runtime import RunConfig
from .s3 import S3
from .settings import Settings
from .utils import Utils
@dataclasses.dataclass

View File

@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from praktika import Workflow
from . import Workflow
class HookInterface(ABC):

View File

@ -1,5 +1,5 @@
from praktika.s3 import S3
from praktika.settings import Settings
from .s3 import S3
from .settings import Settings
class Html:

View File

@ -2,9 +2,9 @@ import copy
import importlib.util
from pathlib import Path
from praktika import Job
from praktika.settings import Settings
from praktika.utils import Utils
from . import Job
from .settings import Settings
from .utils import Utils
def _get_workflows(name=None, file=None):
@ -63,7 +63,7 @@ def _update_workflow_artifacts(workflow):
def _update_workflow_with_native_jobs(workflow):
if workflow.dockers:
from praktika.native_jobs import _docker_build_job
from .native_jobs import _docker_build_job
print(f"Enable native job [{_docker_build_job.name}] for [{workflow.name}]")
aux_job = copy.deepcopy(_docker_build_job)
@ -85,7 +85,7 @@ def _update_workflow_with_native_jobs(workflow):
or workflow.enable_report
or workflow.enable_merge_ready_status
):
from praktika.native_jobs import _workflow_config_job
from .native_jobs import _workflow_config_job
print(f"Enable native job [{_workflow_config_job.name}] for [{workflow.name}]")
aux_job = copy.deepcopy(_workflow_config_job)
@ -96,7 +96,7 @@ def _update_workflow_with_native_jobs(workflow):
job.requires.append(aux_job.name)
if workflow.enable_merge_ready_status:
from praktika.native_jobs import _final_job
from .native_jobs import _final_job
print(f"Enable native job [{_final_job.name}] for [{workflow.name}]")
aux_job = copy.deepcopy(_final_job)

View File

@ -1,19 +1,19 @@
import sys
from typing import Dict
from praktika import Job, Workflow
from praktika._environment import _Environment
from praktika.cidb import CIDB
from praktika.digest import Digest
from praktika.docker import Docker
from praktika.gh import GH
from praktika.hook_cache import CacheRunnerHooks
from praktika.hook_html import HtmlRunnerHooks
from praktika.mangle import _get_workflows
from praktika.result import Result, ResultInfo, _ResultS3
from praktika.runtime import RunConfig
from praktika.settings import Settings
from praktika.utils import Shell, Utils
from . import Job, Workflow
from ._environment import _Environment
from .cidb import CIDB
from .digest import Digest
from .docker import Docker
from .gh import GH
from .hook_cache import CacheRunnerHooks
from .hook_html import HtmlRunnerHooks
from .mangle import _get_workflows
from .result import Result, ResultInfo, _ResultS3
from .runtime import RunConfig
from .settings import Settings
from .utils import Shell, Utils
assert Settings.CI_CONFIG_RUNS_ON

View File

@ -1,8 +1,8 @@
import dataclasses
from typing import Any, Dict, List
from praktika import Artifact, Workflow
from praktika.mangle import _get_workflows
from . import Artifact, Workflow
from .mangle import _get_workflows
class AddonType:

View File

@ -5,11 +5,11 @@ import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from praktika._environment import _Environment
from praktika.cache import Cache
from praktika.s3 import S3
from praktika.settings import Settings
from praktika.utils import ContextManager, MetaClasses, Shell, Utils
from ._environment import _Environment
from .cache import Cache
from .s3 import S3
from .settings import Settings
from .utils import ContextManager, MetaClasses, Shell, Utils
@dataclasses.dataclass

View File

@ -6,17 +6,17 @@ import sys
import traceback
from pathlib import Path
from praktika._environment import _Environment
from praktika.artifact import Artifact
from praktika.cidb import CIDB
from praktika.digest import Digest
from praktika.hook_cache import CacheRunnerHooks
from praktika.hook_html import HtmlRunnerHooks
from praktika.result import Result, ResultInfo
from praktika.runtime import RunConfig
from praktika.s3 import S3
from praktika.settings import Settings
from praktika.utils import Shell, TeePopen, Utils
from ._environment import _Environment
from .artifact import Artifact
from .cidb import CIDB
from .digest import Digest
from .hook_cache import CacheRunnerHooks
from .hook_html import HtmlRunnerHooks
from .result import Result, ResultInfo
from .runtime import RunConfig
from .s3 import S3
from .settings import Settings
from .utils import Shell, TeePopen, Utils
class Runner:

View File

@ -1,9 +1,9 @@
from dataclasses import dataclass
from typing import Dict, List
from praktika.cache import Cache
from praktika.settings import Settings
from praktika.utils import MetaClasses, Utils
from .cache import Cache
from .settings import Settings
from .utils import MetaClasses, Utils
@dataclass

View File

@ -4,9 +4,9 @@ from pathlib import Path
from typing import Dict
from urllib.parse import quote
from praktika._environment import _Environment
from praktika.settings import Settings
from praktika.utils import Shell
from ._environment import _Environment
from .settings import Settings
from .utils import Shell
class S3:

View File

@ -1,7 +1,7 @@
import dataclasses
import os
from praktika.utils import Shell
from .utils import Shell
class Secret:

View File

@ -3,9 +3,9 @@ import sys
from itertools import chain
from pathlib import Path
from praktika import Workflow
from praktika.mangle import _get_workflows
from praktika.settings import GHRunners, Settings
from . import Workflow
from .mangle import _get_workflows
from .settings import GHRunners, Settings
class Validator:

View File

@ -1,10 +1,10 @@
from dataclasses import dataclass, field
from typing import List, Optional
from praktika import Artifact, Job
from praktika.docker import Docker
from praktika.secret import Secret
from praktika.utils import Utils
from . import Artifact, Job
from .docker import Docker
from .secret import Secret
from .utils import Utils
class Workflow:

View File

@ -1,12 +1,12 @@
import dataclasses
from typing import List
from praktika import Artifact, Job, Workflow
from praktika.mangle import _get_workflows
from praktika.parser import WorkflowConfigParser
from praktika.runtime import RunConfig
from praktika.settings import Settings
from praktika.utils import ContextManager, Shell, Utils
from . import Artifact, Job, Workflow
from .mangle import _get_workflows
from .parser import WorkflowConfigParser
from .runtime import RunConfig
from .settings import Settings
from .utils import Shell, Utils
class YamlGenerator: