def can_start_profiling()

in smdebug/profiler/profiler_config.py [0:0]


    def can_start_profiling(self, current_step, current_time):
        """Determine whether the values from the config are valid for profiling."""
        if not self.is_enabled():
            return False

        if current_time is None:
            current_time = time.time()
        if self.has_step_range():
            # pre-step zero or post-hook-close Python profiling
            if current_step == "*":
                return True

            if self.start_step is None:
                self.start_step = current_step
            if self.num_steps is None:
                self.num_steps = PROFILING_NUM_STEPS_DEFAULT
            if not self.end_step:
                self.end_step = self.start_step + self.num_steps
            return self.start_step <= current_step < self.end_step
        elif self.has_time_range():
            if self.start_time_in_sec is None:
                self.start_time_in_sec = current_time
            if self.duration_in_sec:
                if self.end_time is None:
                    self.end_time = self.start_time_in_sec + self.duration_in_sec
                return self.start_time_in_sec <= current_time < self.end_time
            else:
                if self.start_time_in_sec <= current_time:
                    if self.end_step is None:
                        self.end_step = current_step + 1
                    return current_step < self.end_step
        return False