Skip to content

Commit 2c572b8

Browse files
author
mbarber
committed
Merge branch 'dev/embedding' of https://github.com/OpenProteinAI/openprotein-python into release
2 parents db9d36a + 84fc7a3 commit 2c572b8

File tree

6 files changed

+512
-7
lines changed

6 files changed

+512
-7
lines changed

openprotein/api/jobs.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class Job(BaseModel):
4242
start_date: Optional[datetime]
4343
end_date: Optional[datetime]
4444
prerequisite_job_id: Optional[str]
45-
progress_message: Optional[str]
45+
progress_message: Optional[str] = None
4646
progress_counter: Optional[int] = 0
47-
num_records: Optional[int]
47+
num_records: Optional[int] = None
4848

4949
def refresh(self, session: APISession):
5050
"""refresh job status"""
@@ -62,10 +62,11 @@ def _update_progress(self, job) -> int:
6262
"""update rules for jobs without counters"""
6363
progress = job.progress_counter
6464
#if progress is not None: # Check None before comparison
65-
if job.status == JobStatus.PENDING and progress is None:
66-
progress = 5
67-
if job.status == JobStatus.RUNNING and progress is None:
68-
progress = 25
65+
if progress is None:
66+
if job.status == JobStatus.PENDING:
67+
progress = 5
68+
if job.status == JobStatus.RUNNING:
69+
progress = 25
6970
if job.status in [JobStatus.SUCCESS, JobStatus.FAILURE]:
7071
progress = 100
7172
return progress or 0 # never None

openprotein/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class SVDMetadata(BaseModel):
5959
model_id: str
6060
n_components: int
6161
reduction: Optional[str]
62-
sequence_length: Optional[int]
62+
sequence_length: Optional[int] = None
6363

6464
def is_done(self):
6565
return self.status.done()

tests/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def pytest_addoption(parser):
2+
# adapted from https://stackoverflow.com/a/33181491
3+
parser.addoption('--longrun', action='store_true', dest="longrun",
4+
default=False, help="enable longrundecorated tests")
5+
6+
7+
def pytest_configure(config):
8+
config.addinivalue_line(
9+
"markers", "longrun: mark tests that take a long time to run"
10+
)
11+
if not config.option.longrun:
12+
if config.option.markexpr != "":
13+
setattr(
14+
config.option,
15+
'markexpr',
16+
config.option.markexpr + ' and not longrun',
17+
)
18+
else:
19+
setattr(config.option, 'markexpr', 'not longrun')

0 commit comments

Comments
 (0)