[Notes] [Git][BuildStream/buildstream][jennis/add_new_profile_topic] 2 commits: _profile.py: Added a new profiling topic, scheduler



Title: GitLab

James Ennis pushed to branch jennis/add_new_profile_topic at BuildStream / buildstream

Commits:

3 changed files:

Changes:

  • buildstream/_profile.py
    ... ... @@ -46,6 +46,8 @@ class Topics():
    46 46
         LOAD_CONTEXT = 'load-context'
    
    47 47
         LOAD_PROJECT = 'load-project'
    
    48 48
         LOAD_PIPELINE = 'load-pipeline'
    
    49
    +    LOAD_SELECTION = 'load-selection'
    
    50
    +    SCHEDULER = 'scheduler'
    
    49 51
         SHOW = 'show'
    
    50 52
         ARTIFACT_RECEIVE = 'artifact-receive'
    
    51 53
         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()
    
    ... ... @@ -151,11 +152,16 @@ class Scheduler():
    151 152
             # Handle unix signals while running
    
    152 153
             self._connect_signals()
    
    153 154
     
    
    155
    +        # Start the profiler
    
    156
    +        profile_start(Topics.SCHEDULER, "_".join(queue.action_name for queue in self.queues))
    
    157
    +
    
    154 158
             # Run the queues
    
    155 159
             self._sched()
    
    156 160
             self.loop.run_forever()
    
    157 161
             self.loop.close()
    
    158 162
     
    
    163
    +        profile_end(Topics.SCHEDULER, "_".join(queue.action_name for queue in self.queues))
    
    164
    +
    
    159 165
             # Stop handling unix signals
    
    160 166
             self._disconnect_signals()
    
    161 167
     
    

  • 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]