Skip to content

Commit 07deeb0

Browse files
Update Client to Use Epoch Second
1 parent 309c01d commit 07deeb0

15 files changed

Lines changed: 122 additions & 122 deletions

File tree

python-restclient/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Class | Method | HTTP request | Description
9797
*BioModelResourceApi* | [**get_bio_model_vcml**](docs/BioModelResourceApi.md#get_bio_model_vcml) | **GET** /api/v1/bioModel/{bioModelID}/vcml_download | Get the BioModel in VCML format.
9898
*BioModelResourceApi* | [**save_bio_model**](docs/BioModelResourceApi.md#save_bio_model) | **POST** /api/v1/bioModel | Save's the given BioModel. Optional parameters of name and simulations to update due to math changes. Returns saved BioModel as VCML.
9999
*ExportResourceApi* | [**export_n5**](docs/ExportResourceApi.md#export_n5) | **POST** /api/v1/export/N5 |
100-
*ExportResourceApi* | [**export_status**](docs/ExportResourceApi.md#export_status) | **PATCH** /api/v1/export/status |
100+
*ExportResourceApi* | [**export_status**](docs/ExportResourceApi.md#export_status) | **GET** /api/v1/export/status |
101101
*FieldDataResourceApi* | [**advanced_create**](docs/FieldDataResourceApi.md#advanced_create) | **POST** /api/v1/fieldData/advancedCreate | Create Field Data with granular detail in one request.The following files are accepted: .tif and .zip.
102102
*FieldDataResourceApi* | [**analyze_file**](docs/FieldDataResourceApi.md#analyze_file) | **POST** /api/v1/fieldData/analyzeFile | Analyze uploaded image file (Tiff, Zip, and Non-GPL BioFormats) and return field data. Color mapped images not supported (the colors in those images will be interpreted as separate channels). Filenames must be lowercase alphanumeric, and can contain underscores.
103103
*FieldDataResourceApi* | [**copy_models_field_data**](docs/FieldDataResourceApi.md#copy_models_field_data) | **POST** /api/v1/fieldData/copyModelsFieldData | Copy all existing field data from a BioModel/MathModel that you have access to, but don't own.

python-restclient/docs/ExportResourceApi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All URIs are relative to *https://vcell.cam.uchc.edu*
55
Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**export_n5**](ExportResourceApi.md#export_n5) | **POST** /api/v1/export/N5 |
8-
[**export_status**](ExportResourceApi.md#export_status) | **PATCH** /api/v1/export/status |
8+
[**export_status**](ExportResourceApi.md#export_status) | **GET** /api/v1/export/status |
99

1010

1111
# **export_n5**
@@ -84,11 +84,11 @@ Name | Type | Description | Notes
8484
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
8585

8686
# **export_status**
87-
> List[ExportEvent] export_status(body=body)
87+
> List[ExportEvent] export_status(timestamp=timestamp)
8888
8989

9090

91-
Get the status of your export jobs past the timestamp (UTC format).
91+
Get the status of your export jobs past the timestamp (Unix epoch in seconds).
9292

9393
### Example
9494

@@ -115,10 +115,10 @@ configuration = vcell_client.Configuration(
115115
with vcell_client.ApiClient(configuration) as api_client:
116116
# Create an instance of the API class
117117
api_instance = vcell_client.ExportResourceApi(api_client)
118-
body = '2013-10-20T19:20:30+01:00' # datetime | (optional)
118+
timestamp = 56 # int | (optional)
119119

120120
try:
121-
api_response = api_instance.export_status(body=body)
121+
api_response = api_instance.export_status(timestamp=timestamp)
122122
print("The response of ExportResourceApi->export_status:\n")
123123
pprint(api_response)
124124
except Exception as e:
@@ -131,7 +131,7 @@ with vcell_client.ApiClient(configuration) as api_client:
131131

132132
Name | Type | Description | Notes
133133
------------- | ------------- | ------------- | -------------
134-
**body** | **datetime**| | [optional]
134+
**timestamp** | **int**| | [optional]
135135

136136
### Return type
137137

@@ -143,7 +143,7 @@ Name | Type | Description | Notes
143143

144144
### HTTP request headers
145145

146-
- **Content-Type**: application/json
146+
- **Content-Type**: Not defined
147147
- **Accept**: application/json
148148

149149
### HTTP response details

python-restclient/vcell_client/api/export_resource_api.py

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
except ImportError:
2525
from typing_extensions import Annotated
2626

27-
from datetime import datetime
27+
from pydantic import StrictInt
2828

2929
from typing import List, Optional
3030

@@ -342,7 +342,7 @@ def _export_n5_serialize(
342342
@validate_call
343343
def export_status(
344344
self,
345-
body: Optional[datetime] = None,
345+
timestamp: Optional[StrictInt] = None,
346346
_request_timeout: Union[
347347
None,
348348
Annotated[StrictFloat, Field(gt=0)],
@@ -358,10 +358,10 @@ def export_status(
358358
) -> List[ExportEvent]:
359359
"""export_status
360360
361-
Get the status of your export jobs past the timestamp (UTC format).
361+
Get the status of your export jobs past the timestamp (Unix epoch in seconds).
362362
363-
:param body:
364-
:type body: datetime
363+
:param timestamp:
364+
:type timestamp: int
365365
:param _request_timeout: timeout setting for this request. If one
366366
number provided, it will be total request
367367
timeout. It can also be a pair (tuple) of
@@ -385,7 +385,7 @@ def export_status(
385385
""" # noqa: E501
386386

387387
_param = self._export_status_serialize(
388-
body=body,
388+
timestamp=timestamp,
389389
_request_auth=_request_auth,
390390
_content_type=_content_type,
391391
_headers=_headers,
@@ -413,7 +413,7 @@ def export_status(
413413
@validate_call
414414
def export_status_with_http_info(
415415
self,
416-
body: Optional[datetime] = None,
416+
timestamp: Optional[StrictInt] = None,
417417
_request_timeout: Union[
418418
None,
419419
Annotated[StrictFloat, Field(gt=0)],
@@ -429,10 +429,10 @@ def export_status_with_http_info(
429429
) -> ApiResponse[List[ExportEvent]]:
430430
"""export_status
431431
432-
Get the status of your export jobs past the timestamp (UTC format).
432+
Get the status of your export jobs past the timestamp (Unix epoch in seconds).
433433
434-
:param body:
435-
:type body: datetime
434+
:param timestamp:
435+
:type timestamp: int
436436
:param _request_timeout: timeout setting for this request. If one
437437
number provided, it will be total request
438438
timeout. It can also be a pair (tuple) of
@@ -456,7 +456,7 @@ def export_status_with_http_info(
456456
""" # noqa: E501
457457

458458
_param = self._export_status_serialize(
459-
body=body,
459+
timestamp=timestamp,
460460
_request_auth=_request_auth,
461461
_content_type=_content_type,
462462
_headers=_headers,
@@ -484,7 +484,7 @@ def export_status_with_http_info(
484484
@validate_call
485485
def export_status_without_preload_content(
486486
self,
487-
body: Optional[datetime] = None,
487+
timestamp: Optional[StrictInt] = None,
488488
_request_timeout: Union[
489489
None,
490490
Annotated[StrictFloat, Field(gt=0)],
@@ -500,10 +500,10 @@ def export_status_without_preload_content(
500500
) -> RESTResponseType:
501501
"""export_status
502502
503-
Get the status of your export jobs past the timestamp (UTC format).
503+
Get the status of your export jobs past the timestamp (Unix epoch in seconds).
504504
505-
:param body:
506-
:type body: datetime
505+
:param timestamp:
506+
:type timestamp: int
507507
:param _request_timeout: timeout setting for this request. If one
508508
number provided, it will be total request
509509
timeout. It can also be a pair (tuple) of
@@ -527,7 +527,7 @@ def export_status_without_preload_content(
527527
""" # noqa: E501
528528

529529
_param = self._export_status_serialize(
530-
body=body,
530+
timestamp=timestamp,
531531
_request_auth=_request_auth,
532532
_content_type=_content_type,
533533
_headers=_headers,
@@ -550,7 +550,7 @@ def export_status_without_preload_content(
550550

551551
def _export_status_serialize(
552552
self,
553-
body,
553+
timestamp,
554554
_request_auth,
555555
_content_type,
556556
_headers,
@@ -572,11 +572,13 @@ def _export_status_serialize(
572572

573573
# process the path parameters
574574
# process the query parameters
575+
if timestamp is not None:
576+
577+
_query_params.append(('timestamp', timestamp))
578+
575579
# process the header parameters
576580
# process the form parameters
577581
# process the body parameter
578-
if body is not None:
579-
_body_params = body
580582

581583

582584
# set the HTTP header `Accept`
@@ -586,27 +588,14 @@ def _export_status_serialize(
586588
]
587589
)
588590

589-
# set the HTTP header `Content-Type`
590-
if _content_type:
591-
_header_params['Content-Type'] = _content_type
592-
else:
593-
_default_content_type = (
594-
self.api_client.select_header_content_type(
595-
[
596-
'application/json'
597-
]
598-
)
599-
)
600-
if _default_content_type is not None:
601-
_header_params['Content-Type'] = _default_content_type
602591

603592
# authentication setting
604593
_auth_settings: List[str] = [
605594
'openId'
606595
]
607596

608597
return self.api_client.param_serialize(
609-
method='PATCH',
598+
method='GET',
610599
resource_path='/api/v1/export/status',
611600
path_params=_path_params,
612601
query_params=_query_params,

tools/openapi.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,18 @@ paths:
462462
- openId:
463463
- user
464464
/api/v1/export/status:
465-
patch:
465+
get:
466466
tags:
467467
- Export Resource
468-
description: Get the status of your export jobs past the timestamp (UTC format).
468+
description: Get the status of your export jobs past the timestamp (Unix epoch
469+
in seconds).
469470
operationId: exportStatus
470-
requestBody:
471-
content:
472-
application/json:
473-
schema:
474-
$ref: '#/components/schemas/Instant'
471+
parameters:
472+
- name: timestamp
473+
in: query
474+
schema:
475+
format: int64
476+
type: integer
475477
responses:
476478
"200":
477479
description: OK

vcell-apiclient/src/main/java/org/vcell/api/server/AsynchMessageManager.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.time.Instant;
1313
import java.time.OffsetDateTime;
1414
import java.util.List;
15-
import java.util.Set;
1615
import java.util.concurrent.ScheduledExecutorService;
1716
import java.util.concurrent.ScheduledFuture;
1817
import java.util.concurrent.TimeUnit;
@@ -48,7 +47,6 @@
4847
import cbit.vcell.resource.VCellExecutorService;
4948
import cbit.vcell.server.VCellConnection;
5049
import edu.uchc.connjur.wb.ExecutionTrace;
51-
import org.vcell.util.ObjectNotFoundException;
5250

5351
/**
5452
* {@link AsynchMessageManager} polls from {@link VCellConnection} to get remote messages. Remote Messages include the following:
@@ -72,7 +70,7 @@ public class AsynchMessageManager implements AsyncMessageManagerInterface {
7270
private long pollTime = BASE_POLL_SECONDS;
7371
private AtomicBoolean bPoll = new AtomicBoolean(false);
7472
private ScheduledFuture<?> pollingHandle = null;
75-
private OffsetDateTime lastPoll = OffsetDateTime.now();
73+
private long lastPollEpochSecond = Instant.now().getEpochSecond();
7674
/**
7775
* for {@link #schedule(long)} method
7876
*/
@@ -143,10 +141,10 @@ private void poll( ) {
143141
pollTime = BASE_POLL_SECONDS;
144142
queuedEvents = clientServerManager.getMessageEvents();
145143
try{
146-
List<org.vcell.restclient.model.ExportEvent> setOfExports = clientServerManager.getVCellApiClient().getExportApi().exportStatus(lastPoll);
144+
List<org.vcell.restclient.model.ExportEvent> setOfExports = clientServerManager.getVCellApiClient().getExportApi().exportStatus(lastPollEpochSecond);
147145
List<ExportEvent> exportEvents = setOfExports.stream().map(DtoModelTransforms::dtoToExportEvent).toList();
148146
queuedEvents = Stream.concat(exportEvents.stream(), Stream.of(queuedEvents)).toArray(MessageEvent[]::new);
149-
lastPoll = OffsetDateTime.now();
147+
lastPollEpochSecond = Instant.now().getEpochSecond();
150148
} catch (ApiException ex){
151149
throw ExceptionHandler.getProperException(ex);
152150
}

vcell-rest/src/main/java/org/vcell/restq/handlers/ExportResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public ExportHistory deleteExportHistoryEntry() throws DataAccessWebException, N
7474
}
7575

7676
@Path("/status")
77-
@PATCH
77+
@GET
7878
@RolesAllowed("user")
7979
@Produces(MediaType.APPLICATION_JSON)
80-
@Operation(operationId = "exportStatus", description = "Get the status of your export jobs past the timestamp (UTC format).")
81-
public List<ExportEvent> pollExportStatus(Instant timestamp) throws DataAccessWebException, NotAuthenticatedWebException {
80+
@Operation(operationId = "exportStatus", description = "Get the status of your export jobs past the timestamp (Unix epoch in seconds).")
81+
public List<ExportEvent> pollExportStatus(@QueryParam("timestamp") long timestamp) throws DataAccessWebException, NotAuthenticatedWebException {
8282
User user = userRestService.getUserFromIdentity(securityIdentity);
8383
return exportService.getMostRecentExportStatus(user, timestamp);
8484
}

vcell-rest/src/main/java/org/vcell/restq/services/Exports/ExportService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public Multi<ExportEvent> getExportStatuses(User user, long jobID) throws Object
4848
return ((ServerExportEventController) exportStatusCreator.get()).getSSEUsersExportStatus(user, jobID);
4949
}
5050

51-
public List<ExportEvent> getMostRecentExportStatus(User user, Instant instant) {
52-
return exportStatusListener.get().getMostRecentExportStatus(user, instant);
51+
public List<ExportEvent> getMostRecentExportStatus(User user, long timestamp) {
52+
return exportStatusListener.get().getMostRecentExportStatus(user, Instant.ofEpochSecond(timestamp));
5353
}
5454

5555
public ExportRequestListenerMQ.ExportJob createExportJobFromRequest(User user, ExportResource.StandardExportInfo request, FormatSpecificSpecs formatSpecificSpecs, ExportFormat format) throws DataAccessException, SQLException {

vcell-rest/src/test/java/org/vcell/restq/exports/ExportRequestTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.File;
2828
import java.io.IOException;
2929
import java.sql.SQLException;
30+
import java.time.Instant;
3031
import java.time.OffsetDateTime;
3132
import java.util.ArrayList;
3233
import java.util.Arrays;
@@ -76,7 +77,7 @@ public void removeOIDCMappings() throws SQLException, DataAccessException {
7677
// Tests the clients capability to submit exports, our queue for accepting and distributing messages, retrieval of export status, and the export job itself
7778
@Test
7879
public void testExportRequestClient() throws Exception {
79-
final OffsetDateTime time = OffsetDateTime.now(); // Before export even starts, so that all events are grabbed from the queue
80+
final long time = Instant.now().getEpochSecond(); // Before export even starts, so that all events are grabbed from the queue
8081
ExportResourceApi exportResourceApi = new ExportResourceApi(aliceAPIClient);
8182
N5ExportRequest exportRequest = getValidExportRequestDTO(0, 1);
8283
exportResourceApi.exportN5(exportRequest);

vcell-rest/src/test/java/org/vcell/restq/exports/ManualTestExport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.io.IOException;
1111
import java.net.URI;
1212
import java.net.URISyntaxException;
13+
import java.time.Instant;
1314
import java.time.OffsetDateTime;
1415
import java.util.ArrayList;
1516
import java.util.List;
@@ -19,7 +20,7 @@ public class ManualTestExport {
1920
public static void main(String[] args) throws URISyntaxException, IOException, ParseException, ApiException, InterruptedException {
2021
int numOfExports = 12;
2122

22-
OffsetDateTime time = OffsetDateTime.now();
23+
long time = Instant.now().getEpochSecond();
2324
ApiClient apiClient = InteractiveLogin.login(new URI(InteractiveLogin.authDomain),
2425
new URI("https://minikube.remote"), true);
2526
System.setProperty("jdk.internal.httpclient.disableHostnameVerification", "true");

vcell-restclient/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ Class | Method | HTTP request | Description
121121
*BioModelResourceApi* | [**saveBioModelWithHttpInfo**](docs/BioModelResourceApi.md#saveBioModelWithHttpInfo) | **POST** /api/v1/bioModel | Save&#39;s the given BioModel. Optional parameters of name and simulations to update due to math changes. Returns saved BioModel as VCML.
122122
*ExportResourceApi* | [**exportN5**](docs/ExportResourceApi.md#exportN5) | **POST** /api/v1/export/N5 |
123123
*ExportResourceApi* | [**exportN5WithHttpInfo**](docs/ExportResourceApi.md#exportN5WithHttpInfo) | **POST** /api/v1/export/N5 |
124-
*ExportResourceApi* | [**exportStatus**](docs/ExportResourceApi.md#exportStatus) | **PATCH** /api/v1/export/status |
125-
*ExportResourceApi* | [**exportStatusWithHttpInfo**](docs/ExportResourceApi.md#exportStatusWithHttpInfo) | **PATCH** /api/v1/export/status |
124+
*ExportResourceApi* | [**exportStatus**](docs/ExportResourceApi.md#exportStatus) | **GET** /api/v1/export/status |
125+
*ExportResourceApi* | [**exportStatusWithHttpInfo**](docs/ExportResourceApi.md#exportStatusWithHttpInfo) | **GET** /api/v1/export/status |
126126
*FieldDataResourceApi* | [**advancedCreate**](docs/FieldDataResourceApi.md#advancedCreate) | **POST** /api/v1/fieldData/advancedCreate | Create Field Data with granular detail in one request.The following files are accepted: .tif and .zip.
127127
*FieldDataResourceApi* | [**advancedCreateWithHttpInfo**](docs/FieldDataResourceApi.md#advancedCreateWithHttpInfo) | **POST** /api/v1/fieldData/advancedCreate | Create Field Data with granular detail in one request.The following files are accepted: .tif and .zip.
128128
*FieldDataResourceApi* | [**analyzeFile**](docs/FieldDataResourceApi.md#analyzeFile) | **POST** /api/v1/fieldData/analyzeFile | Analyze uploaded image file (Tiff, Zip, and Non-GPL BioFormats) and return field data. Color mapped images not supported (the colors in those images will be interpreted as separate channels). Filenames must be lowercase alphanumeric, and can contain underscores.

0 commit comments

Comments
 (0)