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

Mark TestStandardTaskRunner::test_read_task_utilization as db test #39776

Merged

Conversation

Taragolis
Copy link
Contributor

@Taragolis Taragolis commented May 23, 2024

Fix failing main

breeze shell --backend none

root@a2b2d941fc72:/opt/airflow# pytest tests --skip-db-tests tests/task/task_runner/test_standard_task_runner.py

======================================================= FAILURES ========================================================
___________________________________ TestStandardTaskRunner.test_read_task_utilization ___________________________________

self = <tests.task.task_runner.test_standard_task_runner.TestStandardTaskRunner object at 0xffff9b97e460>
mock_init = <MagicMock name='_init_file' id='281472688691328'>
mock_stats = <MagicMock name='gauge' id='281472686772336'>

    @mock.patch("airflow.task.task_runner.standard_task_runner.Stats.gauge")
    @patch("airflow.utils.log.file_task_handler.FileTaskHandler._init_file")
    def test_read_task_utilization(self, mock_init, mock_stats):
        mock_init.return_value = "/tmp/any"
        Job = mock.Mock()
        Job.job_type = None
        Job.task_instance = mock.MagicMock()
        Job.task_instance.task_id = "task_id"
        Job.task_instance.dag_id = "dag_id"
        Job.task_instance.run_as_user = None
        Job.task_instance.command_as_list.return_value = [
            "airflow",
            "tasks",
            "run",
            "test_on_kill",
            "task1",
            "2016-01-01",
        ]
        job_runner = LocalTaskJobRunner(job=Job, task_instance=Job.task_instance)
        task_runner = StandardTaskRunner(job_runner)
>       task_runner.start()

tests/task/task_runner/test_standard_task_runner.py:472: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
airflow/task/task_runner/standard_task_runner.py:55: in start
    self.process = self._start_by_fork()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <airflow.task.task_runner.standard_task_runner.StandardTaskRunner object at 0xffff7768c640>

    def _start_by_fork(self):
        pid = os.fork()
        if pid:
            self.log.info("Started process %d to run task", pid)
            return psutil.Process(pid)
        else:
            # Start a new process group
            set_new_process_group()
            import signal
    
            signal.signal(signal.SIGINT, signal.SIG_DFL)
            signal.signal(signal.SIGTERM, signal.SIG_DFL)
    
            from airflow import settings
            from airflow.cli.cli_parser import get_parser
            from airflow.sentry import Sentry
    
            if not InternalApiConfig.get_use_internal_api():
                # Force a new SQLAlchemy session. We can't share open DB handles
                # between process. The cli code will re-create this as part of its
                # normal startup
>               settings.engine.pool.dispose()
E               AttributeError: 'NoneType' object has no attribute 'pool'

airflow/task/task_runner/standard_task_runner.py:90: AttributeError

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@Taragolis Taragolis requested review from vincbeck, potiuk, uranusjr, ephraimbuddy, hussein-awala, eladkal and josh-fell and removed request for vincbeck May 23, 2024 07:05
@Taragolis Taragolis added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label May 23, 2024
@Taragolis Taragolis merged commit abd85a9 into apache:main May 23, 2024
42 checks passed
@Taragolis Taragolis deleted the mark-test-read-task-utilization-as-db branch May 23, 2024 09:42
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants