Skip to content

Commit e754104

Browse files
committed
fix: pylint
1 parent 0a3664a commit e754104

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

services/staging/rs_server_staging/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from . import jobs_table # DON'T REMOVE (needed for SQLAlchemy)
5353
from .rspy_models import ProcessMetadataModel
5454

55-
local_mode = env_bool("RSPY_LOCAL_MODE", default=False)
55+
LOCAL_MODE = env_bool("RSPY_LOCAL_MODE", default=False)
5656

5757
logger = Logging.default(__name__)
5858

@@ -211,7 +211,7 @@ async def app_lifespan(fastapi_app: FastAPI): # pylint: disable=too-many-statem
211211

212212
# In local mode, if the gateway is not defined, create a dask LocalCluster
213213
cluster = None
214-
if local_mode and ("RSPY_DASK_STAGING_CLUSTER_NAME" not in os.environ):
214+
if LOCAL_MODE and ("RSPY_DASK_STAGING_CLUSTER_NAME" not in os.environ):
215215
# Create the LocalCluster only in local mode
216216
cluster = LocalCluster()
217217
logger.info("Local Dask cluster created at startup.")
@@ -225,7 +225,7 @@ async def app_lifespan(fastapi_app: FastAPI): # pylint: disable=too-many-statem
225225

226226
# Shutdown logic (cleanup)
227227
logger.info("Shutting down the application...")
228-
if local_mode and cluster:
228+
if LOCAL_MODE and cluster:
229229
cluster.close()
230230
logger.info("Local Dask cluster shut down.")
231231

@@ -328,7 +328,7 @@ async def get_specific_job_result_endpoint(job_id: str = Path(..., title="The ID
328328
raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail=f"Job with ID {job_id} not found") from error
329329

330330

331-
if local_mode:
331+
if LOCAL_MODE:
332332

333333
@router.post("/staging/dask/auth")
334334
async def dask_auth(local_dask_username: str, local_dask_password: str):

services/staging/rs_server_staging/processors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
from .rspy_models import Feature, FeatureCollectionModel
4646

47-
local_mode = env_bool("RSPY_LOCAL_MODE", default=False)
47+
LOCAL_MODE = env_bool("RSPY_LOCAL_MODE", default=False)
4848

4949

5050
# Custom authentication class
@@ -619,7 +619,7 @@ def manage_dask_tasks_results(self, client: Client, catalog_collection: str):
619619
self.log_job_execution(JobStatus.successful, 100, "Finished")
620620
self.logger.info("Tasks monitoring finished")
621621

622-
def dask_cluster_connect(self) -> Client:
622+
def dask_cluster_connect(self) -> Client: # pylint: disable=too-many-branches,too-many-statements
623623
"""Connects a dask cluster scheduler
624624
Establishes a connection to a Dask cluster, either in a local environment or via a Dask Gateway in
625625
a Kubernetes cluster. This method checks if the cluster is already created (for local mode) or connects
@@ -682,7 +682,7 @@ def dask_cluster_connect(self) -> Client:
682682
cluster_name = os.environ["RSPY_DASK_STAGING_CLUSTER_NAME"]
683683

684684
# In local mode, authenticate to the dask cluster with username/password
685-
if local_mode:
685+
if LOCAL_MODE:
686686
gateway_auth = BasicAuth(
687687
os.environ["LOCAL_DASK_USERNAME"],
688688
os.environ["LOCAL_DASK_PASSWORD"],
@@ -708,7 +708,7 @@ def dask_cluster_connect(self) -> Client:
708708

709709
# In local mode, get the first cluster from the gateway.
710710
cluster_id = None
711-
if local_mode:
711+
if LOCAL_MODE:
712712
if clusters:
713713
cluster_id = clusters[0].name
714714

0 commit comments

Comments
 (0)