Module ImportFrom alias ImportFrom alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Assign NameStore Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad keyword NameLoad Assign AttributeStore NameLoad attr Dict For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Return Dict Str Str Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad Str attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr body Raise Call NameLoad Call AttributeLoad Str attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad Call NameLoad keyword AttributeLoad NameLoad attr keyword Call AttributeLoad Str attr NameLoad keyword TupleLoad NameLoad NameLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str If BoolOpAnd CompareIsNot NameLoad NameLoad CompareNotEq NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Call AttributeLoad Str attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad keyword AttributeLoad NameLoad attr keyword Call AttributeLoad Str attr NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr While UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr If BoolOpOr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr UnaryOpNot AttributeLoad NameLoad attr body Return Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body If UnaryOpNot Call AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Return Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Return Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BoolOpOr NameLoad Str Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Dict Str Str Str Call AttributeLoad Str attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword NameLoad Assign AttributeStore NameLoad attr Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr keyword Num Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore NameLoad TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr handlers ExceptHandler type AttributeLoad NameLoad attr body Assign NameStore NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str If CompareNotEq NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Call AttributeLoad Str attr NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad Call NameLoad keyword AttributeLoad NameLoad attr keyword TupleLoad NameLoad NameLoad NameLoad NameLoad keyword Call AttributeLoad Str attr NameLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad Return Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Dict Str Str Str NameLoad NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Str NameLoad Str Assign NameStore Dict Str Str Call AttributeLoad Str attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Dict Str AttributeLoad NameLoad attr Assign NameStore Dict Str TupleLoad Str Call NameLoad NameLoad Str Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword Dict Str Dict Str NameLoad keyword Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad NameLoad body Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str decorator_list
N/A enum Enum queue Queue N/A sys N/A time N/A requests app.common.cluster_service ClusterService app.project_type.project_type SetupFailureError app.slave.subjob_executor SubjobExecutor app.util analytics log util app.util.exceptions BadRequestError app.util.network Network app.util.safe_thread SafeThread app.util.secret Secret app.util.session_id SessionId app.util.single_use_coin SingleUseCoin app.util.unhandled_exception_handler UnhandledExceptionHandler app.util.url_builder UrlBuilder ClusterSlave N/A ClusterService N/A N/A API_VERSION v1 __init__ N/A N/A self port host num_executors N/A 10 N/A N/A 
        :param port: The port number the slave service is running on
        :type port: int
        :param host: The hostname at which the slave is reachable
        :type host: str
        :param num_executors: The number of executors this slave should operate with -- this determines how many
            concurrent subjobs the slave can execute.
        :type num_executors: int
         N/A N/A self port port N/A N/A self host host N/A N/A self is_alive True N/A N/A self _slave_id None N/A N/A self _num_executors num_executors N/A N/A self _logger N/A N/A log get_logger __name__ N/A N/A self _idle_executors N/A Queue maxsize num_executors N/A N/A self executors_by_id N/A N/A executor_id N/A range num_executors N/A N/A executor N/A SubjobExecutor executor_id N/A N/A N/A N/A self _idle_executors put executor N/A N/A N/A self executors_by_id N/A executor_id executor N/A N/A self _master_url None N/A N/A self _network N/A Network min_connection_poolsize num_executors N/A N/A self _master_api None N/A N/A self _project_type None N/A N/A self _current_build_id None N/A N/A self _build_teardown_coin None N/A N/A self _base_executor_index None N/A api_representation N/A N/A self N/A N/A N/A 
        Gets a dict representing this resource which can be returned in an API response.
        :rtype: dict [str, mixed]
         N/A executors_representation N/A N/A N/A executor api_representation N/A executor N/A N/A N/A self executors_by_id values N/A N/A is_alive master_url current_build_id slave_id executors session_id N/A self is_alive N/A self _master_url N/A self _current_build_id N/A self _slave_id executors_representation N/A N/A SessionId get N/A get_status N/A N/A self N/A N/A N/A 
        Just returns a dumb message and prints it to the console.
         N/A N/A N/A Slave service is up. <Port: {}> format N/A self port N/A setup_build N/A N/A self build_id project_type_params build_executor_start_index N/A N/A N/A 
        Usually called once per build to do build-specific setup. Will block any subjobs from executing until setup
        completes. The actual setup is performed on another thread and will unblock subjobs (via an Event) once it
        finishes.

        :param build_id: The id of the build to run setup on
        :type build_id: int
        :param project_type_params: The parameters that define the project_type this build will execute in
        :type project_type_params: dict
        :param build_executor_start_index: How many executors have alreayd been allocated on other slaves for
        this build
        :type build_executor_start_index: int
         N/A N/A N/A N/A self _logger info Executing setup for build {} (type: {}). build_id N/A N/A project_type_params get type N/A N/A self _current_build_id build_id N/A N/A self _build_teardown_coin N/A SingleUseCoin N/A N/A self _project_type N/A N/A util create_project_type project_type_params N/A N/A N/A N/A N/A self _idle_executors full N/A N/A N/A RuntimeError N/A N/A Slave tried to setup build but not all executors are idle. ({}/{} executors idle.) format N/A N/A N/A self _idle_executors qsize N/A self _num_executors N/A executors N/A list N/A N/A self _idle_executors queue N/A N/A N/A N/A SafeThread target N/A self _async_setup_build name N/A N/A Bld{}-Setup format build_id args N/A executors project_type_params build_executor_start_index start N/A _async_setup_build N/A N/A self executors project_type_params build_executor_start_index N/A N/A N/A 
        Called from setup_build(). Do asynchronous setup for the build so that we can make the call to setup_build()
        non-blocking.

        :type executors: list[SubjobExecutor]
        :type project_type_params: dict
        :type build_executor_start_index: int
         N/A N/A self _base_executor_index build_executor_start_index N/A N/A N/A N/A N/A N/A self _project_type fetch_project N/A executor executors N/A N/A N/A N/A executor configure_project_type project_type_params N/A N/A N/A N/A self _project_type run_job_config_setup N/A N/A N/A SetupFailureError N/A ex N/A N/A N/A N/A N/A self _logger error ex N/A N/A N/A N/A self _logger info Notifying master that build setup has failed for build {}. N/A self _current_build_id N/A N/A N/A self _notify_master_of_state_change N/A SlaveState SETUP_FAILED N/A N/A N/A N/A N/A self _logger info Notifying master that build setup is complete for build {}. N/A self _current_build_id N/A N/A N/A self _notify_master_of_state_change N/A SlaveState SETUP_COMPLETED N/A teardown_build N/A N/A self build_id N/A None N/A N/A 
        Called at the end of each build on each slave before it reports back to the master that it is idle again.

        :param build_id: The build id to teardown -- this parameter is used solely for correctness checking of the
            master, to make sure that the master is not erroneously sending teardown commands for other builds.
        :type build_id: int | None
         N/A N/A N/A self _current_build_id None N/A N/A N/A BadRequestError Tried to teardown a build but no build is active on this slave. N/A N/A N/A build_id None N/A build_id N/A self _current_build_id N/A N/A N/A BadRequestError N/A N/A Tried to teardown build {}, but slave is running build {}! format build_id N/A self _current_build_id N/A N/A N/A N/A SafeThread target N/A self _async_teardown_build name N/A N/A Bld{}-Teardwn format build_id start N/A _async_teardown_build N/A N/A self N/A N/A N/A 
        Called from teardown_build(). Do asynchronous teardown for the build so that we can make the call to
        teardown_build() non-blocking. Also take care of posting back to the master when teardown is complete.
         N/A N/A N/A self _do_build_teardown_and_reset N/A N/A N/A N/A N/A self _idle_executors full N/A N/A N/A N/A time sleep 1 N/A N/A N/A self _send_master_idle_notification N/A _do_build_teardown_and_reset N/A N/A self timeout N/A None N/A N/A 
        Kill any currently running subjobs. Run the teardown_build commands for the current build (with an optional
        timeout). Clear attributes related to the currently running build.

        :param timeout: A maximum time in seconds to allow the teardown process to run before killing
        :type timeout: int | None
         N/A executor N/A N/A N/A self executors_by_id values N/A N/A N/A N/A executor kill N/A N/A N/A N/A self _build_teardown_coin N/A N/A N/A N/A self _build_teardown_coin spend N/A N/A self _project_type N/A N/A N/A N/A N/A N/A self _logger info Executing teardown for build {}. N/A self _current_build_id N/A N/A N/A N/A self _project_type teardown_build timeout timeout N/A N/A N/A N/A self _logger info Build teardown complete for build {}. N/A self _current_build_id N/A N/A self _current_build_id None N/A N/A self _project_type None N/A N/A self _base_executor_index None N/A _send_master_idle_notification N/A N/A self N/A N/A N/A N/A N/A N/A self _is_master_responsive N/A N/A N/A N/A N/A self _logger notice Could not post idle notification to master because master is unresponsive. N/A N/A N/A N/A N/A self _logger info Notifying master that this slave is ready for new builds. N/A N/A N/A self _notify_master_of_state_change N/A SlaveState IDLE N/A _disconnect_from_master N/A N/A self N/A N/A N/A 
        Perform internal bookkeeping, as well as notify the master, that this slave is disconnecting itself
        from the slave pool.
         N/A N/A self is_alive False N/A N/A N/A N/A self _is_master_responsive N/A N/A N/A N/A N/A self _logger notice Could not post disconnect notification to master because master is unresponsive. N/A N/A N/A N/A N/A self _logger info Notifying master that this slave is disconnecting. N/A N/A N/A self _notify_master_of_state_change N/A SlaveState DISCONNECTED N/A connect_to_master N/A N/A self master_url N/A None N/A N/A 
        Notify the master that this slave exists.

        :param master_url: The URL of the master service. If none specified, defaults to localhost:43000.
        :type master_url: str | None
         N/A N/A self is_alive True N/A N/A self _master_url N/A master_url localhost:43000 N/A N/A self _master_api N/A UrlBuilder N/A self _master_url N/A connect_url N/A N/A N/A self _master_api url slave N/A data N/A slave num_executors session_id N/A N/A {}:{} format N/A self host N/A self port N/A self _num_executors N/A N/A SessionId get N/A response N/A N/A N/A self _network post connect_url data data N/A N/A self _slave_id N/A int N/A N/A N/A N/A response json get slave_id N/A N/A N/A N/A self _logger info Slave {}:{} connected to master on {}. N/A self host N/A self port N/A self _master_url N/A N/A N/A N/A N/A UnhandledExceptionHandler singleton add_teardown_callback N/A self _do_build_teardown_and_reset timeout 30 N/A N/A N/A N/A N/A UnhandledExceptionHandler singleton add_teardown_callback N/A self _disconnect_from_master N/A _is_master_responsive N/A N/A self N/A N/A N/A 
        Ping the master to check if it is still alive. Code using this method should treat the return value as a
        *probable* truth since the state of the master can change at any time. This method is not a replacement for
        error handling.

        :return: Whether the master is responsive or not
        :rtype: bool
         N/A is_responsive True N/A N/A N/A N/A N/A N/A self _network get N/A N/A N/A self _master_api url N/A N/A N/A N/A requests ConnectionError N/A N/A is_responsive False N/A is_responsive N/A start_working_on_subjob N/A N/A self build_id subjob_id atomic_commands N/A N/A N/A 
        Begin working on a subjob with the given build id and subjob id. This just starts the subjob execution
        asynchronously on a separate thread.

        :type build_id: int
        :type subjob_id: int
        :type atomic_commands: list[str]
        :return: The text to return in the API response.
        :rtype: dict[str, int]
         N/A N/A build_id N/A self _current_build_id N/A N/A N/A BadRequestError N/A N/A Attempted to start subjob {} for build {}, but current build id is {}. format subjob_id build_id N/A self _current_build_id N/A executor N/A N/A N/A self _idle_executors get N/A N/A N/A N/A SafeThread target N/A self _execute_subjob args N/A build_id subjob_id executor atomic_commands name N/A N/A Bld{}-Sub{} format build_id subjob_id start N/A N/A N/A N/A self _logger info Slave ({}:{}) has received subjob. (Build {}, Subjob {}) N/A self host N/A self port build_id subjob_id N/A N/A executor_id N/A executor id N/A _execute_subjob N/A N/A self build_id subjob_id executor atomic_commands N/A N/A N/A 
        This is the method for executing a subjob asynchronously. This performs the work required by executing the
        specified command, then does a post back to the master results endpoint to signal that the work is done.

        :type build_id: int
        :type subjob_id: int
        :type executor: SubjobExecutor
        :type atomic_commands: list[str]
         N/A subjob_event_data N/A build_id subjob_id executor_id build_id subjob_id N/A executor id N/A N/A N/A analytics record_event N/A analytics SUBJOB_EXECUTION_START subjob_event_data N/A results_file N/A N/A executor execute_subjob build_id subjob_id atomic_commands N/A self _base_executor_index N/A N/A N/A analytics record_event N/A analytics SUBJOB_EXECUTION_FINISH subjob_event_data N/A results_url N/A N/A N/A self _master_api url build build_id subjob subjob_id result N/A data N/A slave metric_data N/A N/A {}:{} format N/A self host N/A self port N/A executor_id N/A executor id N/A files N/A file N/A payload N/A open results_file rb application/x-compressed N/A N/A N/A N/A self _idle_executors put executor N/A N/A N/A N/A self _network post results_url data data files files N/A N/A N/A N/A self _logger info Build {}, Subjob {} completed and sent results to master. build_id subjob_id N/A _notify_master_of_state_change N/A N/A self new_state N/A N/A N/A 
        Send a state notification to the master. This is used to notify the master of events occurring on the slave
        related to build execution progress.

        :type new_state: SlaveState
         N/A state_url N/A N/A N/A self _master_api url slave N/A self _slave_id N/A N/A N/A N/A self _network put_with_digest state_url request_params N/A slave N/A state new_state secret N/A N/A Secret get error_on_failure True N/A kill N/A N/A self N/A N/A N/A 
        Exits without error.
         N/A N/A N/A sys exit 0 N/A N/A SlaveState N/A str Enum N/A N/A 
    An enum of possible slave states. Also inherits from string to allow comparisons with other strings (which is
    useful when including these values in API responses).
     N/A DISCONNECTED DISCONNECTED N/A SHUTDOWN SHUTDOWN N/A IDLE IDLE N/A SETUP_COMPLETED SETUP_COMPLETE N/A SETUP_FAILED SETUP_FAILED N/A