Skip to content

Commit

Permalink
Merge branch 'develop' into 'fb-leap-1141'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gondragos committed Jun 26, 2024
2 parents 3c3f081 + 3edd785 commit 830768e
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 26 deletions.
4 changes: 2 additions & 2 deletions label_studio/feature_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@
},
"fflag_feat_all_leap_883_custom_script_270524_short": {
"key": "fflag_feat_all_leap_883_custom_script_270524_short",
"on": false,
"on": true,
"prerequisites": [],
"targets": [],
"contextTargets": [],
Expand All @@ -1699,7 +1699,7 @@
"trackEvents": false,
"trackEventsFallthrough": false,
"debugEventsUntilDate": null,
"version": 5,
"version": 7,
"deleted": false
},
"fflag_feat_all_lops_315_temp_datasets_limitations_short": {
Expand Down
2 changes: 1 addition & 1 deletion label_studio/projects/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def post(self, request, *args, **kwargs):
x_fern_audiences=['public'],
operation_summary='Update project',
operation_description='Update the project settings for a specific project.',
request_body=ProjectSerializer,
request_body=_project_schema,
),
)
class ProjectAPI(generics.RetrieveUpdateDestroyAPIView):
Expand Down
4 changes: 2 additions & 2 deletions label_studio/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def ml_backend_for_test_predict(ml_backend):
# ML backend with single prediction per task
register_ml_backend_mock(
ml_backend,
url='http://localhost:9092',
url='http://test.ml.backend.for.sdk.com:9092',
predictions={
'results': [
{
Expand All @@ -337,7 +337,7 @@ def ml_backend_for_test_predict(ml_backend):
# ML backend with multiple predictions per task
register_ml_backend_mock(
ml_backend,
url='http://localhost:9093',
url='http://test.ml.backend.for.sdk.com:9093',
predictions={
'results': [
[
Expand Down
4 changes: 2 additions & 2 deletions label_studio/tests/ml/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_get_single_prediction_on_task(business_client, ml_backend_for_test_pred
data={
'project': project.id,
'title': 'ModelSingle',
'url': 'http://localhost:9092',
'url': 'http://test.ml.backend.for.sdk.com:9092',
},
)
assert response.status_code == 201
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_get_multiple_predictions_on_task(business_client, ml_backend_for_test_p
data={
'project': project.id,
'title': 'ModelA',
'url': 'http://localhost:9093',
'url': 'http://test.ml.backend.for.sdk.com:9093',
},
)
assert response.status_code == 201
Expand Down
4 changes: 2 additions & 2 deletions label_studio/tests/sdk/test_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_batch_predictions_single_prediction_per_task(django_live_url, business_
assert len(tasks) == 3

# setup ML backend with single prediction per task
ls.ml.create(url='http://localhost:9092', project=p.id, title='ModelSingle')
ls.ml.create(url='http://test.ml.backend.for.sdk.com:9092', project=p.id, title='ModelSingle')

# batch predict tasks via actions
ls.actions.create(
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_batch_predictions_multiple_predictions_per_task(
assert len(tasks) == 3

# setup ML backend with multiple predictions per task
ls.ml.create(url='http://localhost:9093', project=p.id, title='ModelMultiple')
ls.ml.create(url='http://test.ml.backend.for.sdk.com:9093', project=p.id, title='ModelMultiple')

# batch predict tasks via actions
ls.actions.create(
Expand Down
4 changes: 4 additions & 0 deletions label_studio/tests/sdk/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def test_start_and_get_project(django_live_url, business_client):
assert project
assert project.title == 'New Project'

ls.projects.update(id=project.id, title='Updated Project')
project = ls.projects.get(id=p.id)
assert project.title == 'Updated Project'


def test_delete_project(django_live_url, business_client):
ls = LabelStudio(base_url=django_live_url, api_key=business_client.api_key)
Expand Down
3 changes: 2 additions & 1 deletion label_studio/tests/sdk/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

pytestmark = pytest.mark.django_db
from label_studio_sdk.client import LabelStudio
from tests.sdk.utils import sdk_logs

from label_studio.tests.sdk.utils import sdk_logs


def test_task_CRUD(django_live_url, business_client):
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ openai = "^1.10.0"

# Humansignal repo dependencies

label-studio-sdk = {url = "https://github.com/HumanSignal/label-studio-sdk/archive/64eea7333be550a857481fa1158dcac39e7da3b7.zip"}
label-studio-sdk = {url = "https://github.com/HumanSignal/label-studio-sdk/archive/a84e7633a7335dc1235d2576f8b31fe8bfd66835.zip"}

[tool.poetry.group.test.dependencies]
pytest = "7.2.2"
Expand Down
6 changes: 3 additions & 3 deletions web/dist/apps/labelstudio/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"message": "feat: OPTIC-757: Label Studio App Redesign (#5892)",
"commit": "53101fffb1ab714a231c8ce96c32fa5cd93aa0ea",
"date": "2024-06-24T16:41:58.000Z",
"message": "fix: LEAP-453: Fix annotation and draft being requested at the same time (#6005)",
"commit": "88a45a78857840dc149593334a669c952e78d064",
"date": "2024-06-26T15:07:31.000Z",
"branch": "develop"
}
6 changes: 3 additions & 3 deletions web/dist/libs/datamanager/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"message": "feat: OPTIC-757: Label Studio App Redesign (#5892)",
"commit": "53101fffb1ab714a231c8ce96c32fa5cd93aa0ea",
"date": "2024-06-24T16:41:58.000Z",
"message": "fix: LEAP-453: Fix annotation and draft being requested at the same time (#6005)",
"commit": "88a45a78857840dc149593334a669c952e78d064",
"date": "2024-06-26T15:07:31.000Z",
"branch": "develop"
}
2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions web/dist/libs/editor/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"message": "feat: OPTIC-757: Label Studio App Redesign (#5892)",
"commit": "53101fffb1ab714a231c8ce96c32fa5cd93aa0ea",
"date": "2024-06-24T16:41:58.000Z",
"message": "fix: LEAP-453: Fix annotation and draft being requested at the same time (#6005)",
"commit": "88a45a78857840dc149593334a669c952e78d064",
"date": "2024-06-26T15:07:31.000Z",
"branch": "develop"
}
15 changes: 15 additions & 0 deletions web/libs/editor/src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,19 @@ export default types
});
}

function waitForDraftSubmission() {
return new Promise((resolve) => {
if (!self.annotationStore.selected.isDraftSaving) resolve();

const checkInterval = setInterval(() => {
if (!self.annotationStore.selected.isDraftSaving) {
clearInterval(checkInterval);
resolve();
}
}, 100);
});
}

// Set `isSubmitting` flag to block [Submit] and related buttons during request
// to prevent from sending duplicating requests.
// Better to return request's Promise from SDK to make this work perfect.
Expand Down Expand Up @@ -562,6 +575,7 @@ export default types
}
handleSubmittingFlag(async () => {
if (isFF(FF_CUSTOM_SCRIPT)) {
await self.waitForDraftSubmission();
const allowedToSave = await getEnv(self).events.invoke("beforeSaveAnnotation", self, entity, { event });
if (allowedToSave && allowedToSave.some((x) => x === false)) return;

Expand Down Expand Up @@ -937,6 +951,7 @@ export default types
unskipTask,
setTaskHistory,
submitDraft,
waitForDraftSubmission,
submitAnnotation,
updateAnnotation,
acceptAnnotation,
Expand Down

0 comments on commit 830768e

Please sign in to comment.