Skip to content

Commit 09a76a9

Browse files
committed
exit process
1 parent 53de690 commit 09a76a9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/apify/_actor.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(
6565
configuration: Configuration | None = None,
6666
*,
6767
configure_logging: bool = True,
68-
call_exit: bool | None = None,
68+
exit_process: bool | None = None,
6969
) -> None:
7070
"""Create an Actor instance.
7171
@@ -76,10 +76,10 @@ def __init__(
7676
configuration: The Actor configuration to be used. If not passed, a new Configuration instance will
7777
be created.
7878
configure_logging: Should the default logging configuration be configured?
79-
call_exit: Whether the Actor should call `sys.exit` when the context manager exits. The default is
79+
exit_process: Whether the Actor should call `sys.exit` when the context manager exits. The default is
8080
True except for the IPython, Pytest and Scrapy environments.
8181
"""
82-
self._call_exit = self._get_default_call_exit() if call_exit is None else call_exit
82+
self._exit_process = self._get_default_exit_process() if exit_process is None else exit_process
8383
self._is_exiting = False
8484

8585
self._configuration = configuration or Configuration.get_global_configuration()
@@ -151,13 +151,13 @@ def __call__(
151151
configuration: Configuration | None = None,
152152
*,
153153
configure_logging: bool = True,
154-
call_exit: bool | None = None,
154+
exit_process: bool | None = None,
155155
) -> Self:
156156
"""Make a new Actor instance with a non-default configuration."""
157157
return self.__class__(
158158
configuration=configuration,
159159
configure_logging=configure_logging,
160-
call_exit=call_exit,
160+
exit_process=exit_process,
161161
)
162162

163163
@property
@@ -296,7 +296,7 @@ async def finalize() -> None:
296296
await asyncio.wait_for(finalize(), cleanup_timeout.total_seconds())
297297
self._is_initialized = False
298298

299-
if self._call_exit:
299+
if self._exit_process:
300300
sys.exit(exit_code)
301301

302302
async def fail(
@@ -1137,22 +1137,22 @@ async def create_proxy_configuration(
11371137

11381138
return proxy_configuration
11391139

1140-
def _get_default_call_exit(self) -> bool:
1140+
def _get_default_exit_process(self) -> bool:
11411141
"""Returns False for IPython, Pytest, and Scrapy environments, True otherwise."""
11421142
if is_running_in_ipython():
1143-
self.log.debug('Running in IPython, setting default `call_exit` to False.')
1143+
self.log.debug('Running in IPython, setting default `exit_process` to False.')
11441144
return False
11451145

11461146
# Check if running in Pytest by detecting the relevant environment variable.
11471147
if os.getenv('PYTEST_CURRENT_TEST'):
1148-
self.log.debug('Running in Pytest, setting default `call_exit` to False.')
1148+
self.log.debug('Running in Pytest, setting default `exit_process` to False.')
11491149
return False
11501150

11511151
# Check if running in Scrapy by attempting to import it.
11521152
with suppress(ImportError):
11531153
import scrapy # noqa: F401
11541154

1155-
self.log.debug('Running in Scrapy, setting default `call_exit` to False.')
1155+
self.log.debug('Running in Scrapy, setting default `exit_process` to False.')
11561156
return False
11571157

11581158
return True

0 commit comments

Comments
 (0)