[Notes] [Git][BuildStream/buildstream][master] 4 commits: _profile.py: Added a new profiling topic, scheduler



Title: GitLab

James Ennis pushed to branch master at BuildStream / buildstream

Commits:

3 changed files:

Changes:

  • buildstream/_profile.py
    1 1
     #
    
    2 2
     #  Copyright (C) 2017 Codethink Limited
    
    3
    +#  Copyright (C) 2019 Bloomberg Finance LP
    
    3 4
     #
    
    4 5
     #  This program is free software; you can redistribute it and/or
    
    5 6
     #  modify it under the terms of the GNU Lesser General Public
    
    ... ... @@ -16,6 +17,7 @@
    16 17
     #
    
    17 18
     #  Authors:
    
    18 19
     #        Tristan Van Berkom <tristan vanberkom codethink co uk>
    
    20
    +#        James Ennis <james ennis codethink co uk>
    
    19 21
     
    
    20 22
     import cProfile
    
    21 23
     import pstats
    
    ... ... @@ -46,6 +48,8 @@ class Topics():
    46 48
         LOAD_CONTEXT = 'load-context'
    
    47 49
         LOAD_PROJECT = 'load-project'
    
    48 50
         LOAD_PIPELINE = 'load-pipeline'
    
    51
    +    LOAD_SELECTION = 'load-selection'
    
    52
    +    SCHEDULER = 'scheduler'
    
    49 53
         SHOW = 'show'
    
    50 54
         ARTIFACT_RECEIVE = 'artifact-receive'
    
    51 55
         ALL = 'all'
    

  • buildstream/_scheduler/scheduler.py
    ... ... @@ -29,6 +29,7 @@ from contextlib import contextmanager
    29 29
     # Local imports
    
    30 30
     from .resources import Resources, ResourceType
    
    31 31
     from .jobs import JobStatus, CacheSizeJob, CleanupJob
    
    32
    +from .._profile import Topics, profile_start, profile_end
    
    32 33
     
    
    33 34
     
    
    34 35
     # A decent return code for Scheduler.run()
    
    ... ... @@ -154,11 +155,16 @@ class Scheduler():
    154 155
             # Check if we need to start with some cache maintenance
    
    155 156
             self._check_cache_management()
    
    156 157
     
    
    158
    +        # Start the profiler
    
    159
    +        profile_start(Topics.SCHEDULER, "_".join(queue.action_name for queue in self.queues))
    
    160
    +
    
    157 161
             # Run the queues
    
    158 162
             self._sched()
    
    159 163
             self.loop.run_forever()
    
    160 164
             self.loop.close()
    
    161 165
     
    
    166
    +        profile_end(Topics.SCHEDULER, "_".join(queue.action_name for queue in self.queues))
    
    167
    +
    
    162 168
             # Stop handling unix signals
    
    163 169
             self._disconnect_signals()
    
    164 170
     
    

  • buildstream/_stream.py
    ... ... @@ -32,6 +32,7 @@ from ._exceptions import StreamError, ImplError, BstError, set_last_task_error
    32 32
     from ._message import Message, MessageType
    
    33 33
     from ._scheduler import Scheduler, SchedStatus, TrackQueue, FetchQueue, BuildQueue, PullQueue, PushQueue
    
    34 34
     from ._pipeline import Pipeline, PipelineSelection
    
    35
    +from ._profile import Topics, profile_start, profile_end
    
    35 36
     from . import utils, _yaml, _site
    
    36 37
     from . import Scope, Consistency
    
    37 38
     
    
    ... ... @@ -106,10 +107,16 @@ class Stream():
    106 107
         def load_selection(self, targets, *,
    
    107 108
                            selection=PipelineSelection.NONE,
    
    108 109
                            except_targets=()):
    
    110
    +
    
    111
    +        profile_start(Topics.LOAD_SELECTION, "_".join(t.replace(os.sep, '-') for t in targets))
    
    112
    +
    
    109 113
             elements, _ = self._load(targets, (),
    
    110 114
                                      selection=selection,
    
    111 115
                                      except_targets=except_targets,
    
    112 116
                                      fetch_subprojects=False)
    
    117
    +
    
    118
    +        profile_end(Topics.LOAD_SELECTION, "_".join(t.replace(os.sep, '-') for t in targets))
    
    119
    +
    
    113 120
             return elements
    
    114 121
     
    
    115 122
         # shell()
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]