Skip to content

Commit

Permalink
Run linting with new black rules and fix warnings stacklevel warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Oct 11, 2023
1 parent af76684 commit 8d24905
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/jobflow_remote/cli/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def flow_info(
flow_ids = [jf_id]

with loading_spinner():

jc = JobController()

flows_info = jc.get_flows_info(
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/cli/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def format_job_info(job_info: JobInfo, show_none: bool = False):


def format_flow_info(flow_info: FlowInfo):

title = f"Flow: {flow_info.name} - {flow_info.flow_id} - {flow_info.state.name}"
table = Table(title=title)
table.title_style = "bold"
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/cli/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def job_info(
db_id, job_id = get_job_db_ids(job_db_id, job_index)

with loading_spinner():

jc = JobController()

job_info = jc.get_job_info(
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def convert_metadata(string_metadata: str | None) -> dict | None:


def get_start_date(start_date: datetime | None, days: int | None, hours: int | None):

if start_date and (start_date.year, start_date.month, start_date.day) == (
1900,
1,
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class JobflowRemoteSettings(BaseSettings):

config_file: str = Field(
DEFAULT_CONFIG_FILE_PATH,
description="Location of the config file for jobflow remote.",
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/fireworks/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def checkout_remote(

launch_id = None
try:

fw, launch_id = rlpad.lpad.reserve_fw(fworker, ".", fw_id=fw_id)
if not fw:
logger.info("No jobs exist in the LaunchPad for submission to queue!")
Expand Down
3 changes: 0 additions & 3 deletions src/jobflow_remote/fireworks/launchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ def get_remote_run(
job_id: str | None = None,
job_index: int | None = None,
) -> RemoteRun:

query, sort = self.generate_id_query(fw_id, job_id, job_index)

fw = self.fireworks.find_one(query)
Expand Down Expand Up @@ -697,7 +696,6 @@ def get_wf_fw_data(
sort: dict | None = None,
limit: int = 0,
) -> list[dict]:

pipeline: list[dict] = [
{
"$lookup": {
Expand Down Expand Up @@ -767,7 +765,6 @@ def get_fw_launch_remote_run_data(
sort: dict | None = None,
limit: int = 0,
) -> list[dict]:

# only take the most recent launch
pipeline: list[dict] = [
{
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/jobs/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class DaemonStatus(Enum):


class DaemonManager:

conf_template = Template(supervisord_conf_str)

def __init__(
Expand Down
2 changes: 0 additions & 2 deletions src/jobflow_remote/jobs/jobcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def _build_query_wf(
end_date: datetime | None = None,
name: str | None = None,
) -> dict:

if job_ids is not None and not isinstance(job_ids, (list, tuple)):
job_ids = [job_ids]
if db_ids is not None and not isinstance(db_ids, (list, tuple)):
Expand Down Expand Up @@ -391,7 +390,6 @@ def rerun_jobs(
return fw_ids

def reset(self, reset_output: bool = False, max_limit: int = 25) -> bool:

password = datetime.now().strftime("%Y-%m-%d") if max_limit == 0 else None
try:
self.rlpad.reset(
Expand Down
4 changes: 2 additions & 2 deletions src/jobflow_remote/jobs/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ def lock_and_update(
error, fail_now, set_output = function(doc)
except ConfigError:
error = traceback.format_exc()
warnings.warn(error)
warnings.warn(error, stacklevel=2)
fail_now = True
except Exception:
error = traceback.format_exc()
warnings.warn(error)
warnings.warn(error, stacklevel=2)

lock.update_on_release = self._prepare_lock_update(
doc, error, fail_now, set_output, state.next
Expand Down
1 change: 0 additions & 1 deletion src/jobflow_remote/remote/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def get_remote_store_filenames(store: JobStore) -> list[str]:


def update_store(store, remote_store, save):

# TODO is it correct?
data = list(remote_store.query(load=save))
if len(data) > 1:
Expand Down
6 changes: 2 additions & 4 deletions src/jobflow_remote/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class MongoLock:

LOCK_KEY = "_lock_id"
LOCK_TIME_KEY = "_lock_time"

Expand Down Expand Up @@ -98,7 +97,7 @@ def acquire(self):
msg = (
f"The lock was broken. Previous lock id: {self.get_lock_id(result)}"
)
warnings.warn(msg)
warnings.warn(msg, stacklevel=2)

self.locked_document = result

Expand All @@ -119,7 +118,7 @@ def release(self, exc_type, exc_val, exc_tb):
# Check if the lock was successfully released
if result.modified_count == 0:
msg = f"Could not release lock for document {self.locked_document['_id']}"
warnings.warn(msg)
warnings.warn(msg, stacklevel=2)

self.locked_document = None

Expand All @@ -128,6 +127,5 @@ def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):

if self.locked_document:
self.release(exc_type, exc_val, exc_tb)

0 comments on commit 8d24905

Please sign in to comment.