Skip to content

Commit

Permalink
Fix pending lookup issue #854 (#855)
Browse files Browse the repository at this point in the history
* Fix pending lookup issue #854
  • Loading branch information
ponyisi authored Sep 25, 2024
1 parent 21ab948 commit ba51dd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from flask import request, current_app

from servicex_app.models import Dataset, db, TransformRequest, TransformStatus, DatasetStatus
from servicex_app.dataset_manager import DatasetManager
from servicex_app.resources.servicex_resource import ServiceXResource


Expand All @@ -54,8 +55,9 @@ def put(self, dataset_id):
if summary['files'] > 0:
# Now time to pick up any transform requests for this dataset that came in
# while we were still looking up files and send the dataset to them
dataset_manager = DatasetManager(dataset, current_app.logger, db)
for transform_request in TransformRequest.lookup_pending_on_dataset(int(dataset_id)):
dataset.publish_files(transform_request, self.lookup_result_processor)
dataset_manager.publish_files(transform_request, self.lookup_result_processor)
transform_request.status = TransformStatus.running

# also resolve the status of whatever transform prompted this lookup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from datetime import timezone, datetime

from servicex_app import LookupResultProcessor, TransformerManager
from servicex_app.dataset_manager import DatasetManager
from servicex_app_test.resource_test_base import ResourceTestBase

from servicex_app.models import DatasetStatus, Dataset, TransformRequest, TransformStatus
Expand Down Expand Up @@ -65,6 +66,8 @@ def test_put_fileset_complete(self, mocker, mock_find_dataset_by_id):
return_value=[lookup_request])
mock_processor = mocker.MagicMock(LookupResultProcessor)

mock_publish_files = mocker.patch.object(DatasetManager, "publish_files")

client = self._test_client(lookup_result_processor=mock_processor)

response = client.put('/servicex/internal/transformation/1234/complete',
Expand All @@ -83,7 +86,7 @@ def test_put_fileset_complete(self, mocker, mock_find_dataset_by_id):

mock_lookup_pending.assert_called_once_with(1234)
mock_lookup_running.assert_called_once_with(1234)
dataset.publish_files.assert_called_once_with(pending_request, mock_processor)
mock_publish_files.assert_called_once_with(pending_request, mock_processor)
assert pending_request.status == TransformStatus.running
assert lookup_request.status == TransformStatus.running

Expand Down

0 comments on commit ba51dd9

Please sign in to comment.