You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/01/07 01:22:01 UTC

[jira] [Commented] (AIRFLOW-6452) scheduler_job.py - remove excess sleep/log/duration calls

    [ https://issues.apache.org/jira/browse/AIRFLOW-6452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17009275#comment-17009275 ] 

ASF GitHub Bot commented on AIRFLOW-6452:
-----------------------------------------

tooptoop4 commented on pull request #7089: [AIRFLOW-6452] scheduler_job.py - remove excess sleep/log/duration calls
URL: https://github.com/apache/airflow/pull/7089
 
 
   ---
   Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
   
   - [ ] Description above provides context of the change
   - [ ] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
   - [ ] Unit tests coverage for changes (not needed for documentation changes)
   - [ ] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [ ] Relevant documentation is updated including usage instructions.
   - [ ] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   <sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> scheduler_job.py - remove excess sleep/log/duration calls
> ---------------------------------------------------------
>
>                 Key: AIRFLOW-6452
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6452
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: scheduler
>    Affects Versions: 1.10.7
>            Reporter: t oo
>            Priority: Minor
>
> remove a lot of these debug calls, wrap some in boolean of loglevel, remove the 2nd sleep and stuff about getting duration/start/end.etc:
> self.log.debug("Starting Loop...")
>             loop_start_time = time.time()
>             if self.using_sqlite:
>                 self.processor_agent.heartbeat()
>                 # For the sqlite case w/ 1 thread, wait until the processor
>                 # is finished to avoid concurrent access to the DB.
>                 self.log.debug(
>                     "Waiting for processors to finish since we're using sqlite")
>                 self.processor_agent.wait_until_finished()
>             self.log.debug("Harvesting DAG parsing results")
>             simple_dags = self._get_simple_dags()
>             self.log.debug("Harvested {} SimpleDAGs".format(len(simple_dags)))
>             # Send tasks for execution if available
>             simple_dag_bag = SimpleDagBag(simple_dags)
>             if not self._validate_and_run_task_instances(simple_dag_bag=simple_dag_bag):
>                 continue
>             # Heartbeat the scheduler periodically
>             time_since_last_heartbeat = (timezone.utcnow() -
>                                          last_self_heartbeat_time).total_seconds()
>             if time_since_last_heartbeat > self.heartrate:
>                 self.log.debug("Heartbeating the scheduler")
>                 self.heartbeat()
>                 last_self_heartbeat_time = timezone.utcnow()
>             loop_end_time = time.time()
>             loop_duration = loop_end_time - loop_start_time
>             self.log.debug(
>                 "Ran scheduling loop in %.2f seconds",
>                 loop_duration)
>             if not is_unit_test:
>                 self.log.debug("Sleeping for %.2f seconds", self._processor_poll_interval)
>                 time.sleep(self._processor_poll_interval)
>             if self.processor_agent.done:
>                 self.log.info("Exiting scheduler loop as all files"
>                               " have been processed {} times".format(self.num_runs))
>                 break
>             if loop_duration < 1 and not is_unit_test:
>                 sleep_length = 1 - loop_duration
>                 self.log.debug(
>                     "Sleeping for {0:.2f} seconds to prevent excessive logging"
>                     .format(sleep_length))
>                 sleep(sleep_length)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)