Skip to content

Commit 404b2d1

Browse files
Update Export to Use Topic Instead
1 parent aa5f834 commit 404b2d1

34 files changed

Lines changed: 430 additions & 392 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) | **GET** /api/v1/export/status |
100+
*ExportResourceApi* | [**export_status**](docs/ExportResourceApi.md#export_status) | **PATCH** /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/ExportEvent.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Name | Type | Description | Notes
1212
**job_id** | **int** | | [optional]
1313
**data_key** | **str** | | [optional]
1414
**data_id_string** | **str** | | [optional]
15-
**time_specs** | [**TimeSpecs**](TimeSpecs.md) | | [optional]
16-
**variable_specs** | [**VariableSpecs**](VariableSpecs.md) | | [optional]
1715
**human_readable_data** | [**HumanReadableExportData**](HumanReadableExportData.md) | | [optional]
1816

1917
## Example

python-restclient/docs/ExportResourceApi.md

Lines changed: 10 additions & 6 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) | **GET** /api/v1/export/status |
8+
[**export_status**](ExportResourceApi.md#export_status) | **PATCH** /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()
87+
> List[ExportEvent] export_status(body=body)
8888
8989

9090

91-
Get the status of your most recent export jobs.
91+
Get the status of your export jobs past the timestamp (UTC format).
9292

9393
### Example
9494

@@ -115,9 +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)
118119

119120
try:
120-
api_response = api_instance.export_status()
121+
api_response = api_instance.export_status(body=body)
121122
print("The response of ExportResourceApi->export_status:\n")
122123
pprint(api_response)
123124
except Exception as e:
@@ -127,7 +128,10 @@ with vcell_client.ApiClient(configuration) as api_client:
127128

128129

129130
### Parameters
130-
This endpoint does not need any parameter.
131+
132+
Name | Type | Description | Notes
133+
------------- | ------------- | ------------- | -------------
134+
**body** | **datetime**| | [optional]
131135

132136
### Return type
133137

@@ -139,7 +143,7 @@ This endpoint does not need any parameter.
139143

140144
### HTTP request headers
141145

142-
- **Content-Type**: Not defined
146+
- **Content-Type**: application/json
143147
- **Accept**: application/json
144148

145149
### HTTP response details

python-restclient/vcell_client/api/export_resource_api.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
except ImportError:
2525
from typing_extensions import Annotated
2626

27+
from datetime import datetime
28+
2729
from typing import List, Optional
2830

2931
from vcell_client.models.export_event import ExportEvent
@@ -340,6 +342,7 @@ def _export_n5_serialize(
340342
@validate_call
341343
def export_status(
342344
self,
345+
body: Optional[datetime] = None,
343346
_request_timeout: Union[
344347
None,
345348
Annotated[StrictFloat, Field(gt=0)],
@@ -355,8 +358,10 @@ def export_status(
355358
) -> List[ExportEvent]:
356359
"""export_status
357360
358-
Get the status of your most recent export jobs.
361+
Get the status of your export jobs past the timestamp (UTC format).
359362
363+
:param body:
364+
:type body: datetime
360365
:param _request_timeout: timeout setting for this request. If one
361366
number provided, it will be total request
362367
timeout. It can also be a pair (tuple) of
@@ -380,6 +385,7 @@ def export_status(
380385
""" # noqa: E501
381386

382387
_param = self._export_status_serialize(
388+
body=body,
383389
_request_auth=_request_auth,
384390
_content_type=_content_type,
385391
_headers=_headers,
@@ -407,6 +413,7 @@ def export_status(
407413
@validate_call
408414
def export_status_with_http_info(
409415
self,
416+
body: Optional[datetime] = None,
410417
_request_timeout: Union[
411418
None,
412419
Annotated[StrictFloat, Field(gt=0)],
@@ -422,8 +429,10 @@ def export_status_with_http_info(
422429
) -> ApiResponse[List[ExportEvent]]:
423430
"""export_status
424431
425-
Get the status of your most recent export jobs.
432+
Get the status of your export jobs past the timestamp (UTC format).
426433
434+
:param body:
435+
:type body: datetime
427436
:param _request_timeout: timeout setting for this request. If one
428437
number provided, it will be total request
429438
timeout. It can also be a pair (tuple) of
@@ -447,6 +456,7 @@ def export_status_with_http_info(
447456
""" # noqa: E501
448457

449458
_param = self._export_status_serialize(
459+
body=body,
450460
_request_auth=_request_auth,
451461
_content_type=_content_type,
452462
_headers=_headers,
@@ -474,6 +484,7 @@ def export_status_with_http_info(
474484
@validate_call
475485
def export_status_without_preload_content(
476486
self,
487+
body: Optional[datetime] = None,
477488
_request_timeout: Union[
478489
None,
479490
Annotated[StrictFloat, Field(gt=0)],
@@ -489,8 +500,10 @@ def export_status_without_preload_content(
489500
) -> RESTResponseType:
490501
"""export_status
491502
492-
Get the status of your most recent export jobs.
503+
Get the status of your export jobs past the timestamp (UTC format).
493504
505+
:param body:
506+
:type body: datetime
494507
:param _request_timeout: timeout setting for this request. If one
495508
number provided, it will be total request
496509
timeout. It can also be a pair (tuple) of
@@ -514,6 +527,7 @@ def export_status_without_preload_content(
514527
""" # noqa: E501
515528

516529
_param = self._export_status_serialize(
530+
body=body,
517531
_request_auth=_request_auth,
518532
_content_type=_content_type,
519533
_headers=_headers,
@@ -536,6 +550,7 @@ def export_status_without_preload_content(
536550

537551
def _export_status_serialize(
538552
self,
553+
body,
539554
_request_auth,
540555
_content_type,
541556
_headers,
@@ -560,6 +575,8 @@ def _export_status_serialize(
560575
# process the header parameters
561576
# process the form parameters
562577
# process the body parameter
578+
if body is not None:
579+
_body_params = body
563580

564581

565582
# set the HTTP header `Accept`
@@ -569,14 +586,27 @@ def _export_status_serialize(
569586
]
570587
)
571588

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
572602

573603
# authentication setting
574604
_auth_settings: List[str] = [
575605
'openId'
576606
]
577607

578608
return self.api_client.param_serialize(
579-
method='GET',
609+
method='PATCH',
580610
resource_path='/api/v1/export/status',
581611
path_params=_path_params,
582612
query_params=_query_params,

python-restclient/vcell_client/models/export_event.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
from pydantic import Field
2525
from vcell_client.models.export_progress_type import ExportProgressType
2626
from vcell_client.models.human_readable_export_data import HumanReadableExportData
27-
from vcell_client.models.time_specs import TimeSpecs
2827
from vcell_client.models.user import User
29-
from vcell_client.models.variable_specs import VariableSpecs
3028
try:
3129
from typing import Self
3230
except ImportError:
@@ -44,10 +42,8 @@ class ExportEvent(BaseModel):
4442
job_id: Optional[StrictInt] = Field(default=None, alias="jobID")
4543
data_key: Optional[StrictStr] = Field(default=None, alias="dataKey")
4644
data_id_string: Optional[StrictStr] = Field(default=None, alias="dataIdString")
47-
time_specs: Optional[TimeSpecs] = Field(default=None, alias="timeSpecs")
48-
variable_specs: Optional[VariableSpecs] = Field(default=None, alias="variableSpecs")
4945
human_readable_data: Optional[HumanReadableExportData] = Field(default=None, alias="humanReadableData")
50-
__properties: ClassVar[List[str]] = ["eventType", "progress", "format", "location", "user", "jobID", "dataKey", "dataIdString", "timeSpecs", "variableSpecs", "humanReadableData"]
46+
__properties: ClassVar[List[str]] = ["eventType", "progress", "format", "location", "user", "jobID", "dataKey", "dataIdString", "humanReadableData"]
5147

5248
model_config = {
5349
"populate_by_name": True,
@@ -88,12 +84,6 @@ def to_dict(self) -> Dict[str, Any]:
8884
# override the default output from pydantic by calling `to_dict()` of user
8985
if self.user:
9086
_dict['user'] = self.user.to_dict()
91-
# override the default output from pydantic by calling `to_dict()` of time_specs
92-
if self.time_specs:
93-
_dict['timeSpecs'] = self.time_specs.to_dict()
94-
# override the default output from pydantic by calling `to_dict()` of variable_specs
95-
if self.variable_specs:
96-
_dict['variableSpecs'] = self.variable_specs.to_dict()
9787
# override the default output from pydantic by calling `to_dict()` of human_readable_data
9888
if self.human_readable_data:
9989
_dict['humanReadableData'] = self.human_readable_data.to_dict()
@@ -122,8 +112,6 @@ def from_dict(cls, obj: Dict) -> Self:
122112
"jobID": obj.get("jobID"),
123113
"dataKey": obj.get("dataKey"),
124114
"dataIdString": obj.get("dataIdString"),
125-
"timeSpecs": TimeSpecs.from_dict(obj.get("timeSpecs")) if obj.get("timeSpecs") is not None else None,
126-
"variableSpecs": VariableSpecs.from_dict(obj.get("variableSpecs")) if obj.get("variableSpecs") is not None else None,
127115
"humanReadableData": HumanReadableExportData.from_dict(obj.get("humanReadableData")) if obj.get("humanReadableData") is not None else None
128116
})
129117
return _obj

tools/openapi.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,18 +462,22 @@ paths:
462462
- openId:
463463
- user
464464
/api/v1/export/status:
465-
get:
465+
patch:
466466
tags:
467467
- Export Resource
468-
description: Get the status of your most recent export jobs.
468+
description: Get the status of your export jobs past the timestamp (UTC format).
469469
operationId: exportStatus
470+
requestBody:
471+
content:
472+
application/json:
473+
schema:
474+
$ref: '#/components/schemas/Instant'
470475
responses:
471476
"200":
472477
description: OK
473478
content:
474479
application/json:
475480
schema:
476-
uniqueItems: true
477481
type: array
478482
items:
479483
$ref: '#/components/schemas/ExportEvent'
@@ -2511,10 +2515,6 @@ components:
25112515
$ref: '#/components/schemas/KeyValue'
25122516
dataIdString:
25132517
type: string
2514-
timeSpecs:
2515-
$ref: '#/components/schemas/TimeSpecs'
2516-
variableSpecs:
2517-
$ref: '#/components/schemas/VariableSpecs'
25182518
humanReadableData:
25192519
$ref: '#/components/schemas/HumanReadableExportData'
25202520
ExportProgressType:

vcell-api-types/src/main/java/org/vcell/api/types/utils/DTOModelTransformerV0.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,21 @@ public static DataJobEvent dataJobEventFromJsonRep(Object eventSource, DataJobEv
5555

5656
public static ExportEvent exportEventFromJsonRep(Object eventSource, ExportEventRepresentation rep) {
5757
User user = new User(rep.username, new KeyValue(rep.userkey));
58-
TimeSpecs timeSpecs = null;
59-
if (rep.exportTimeSpecs!=null) {
60-
timeSpecs = timeSpecsFromJsonRep(rep.exportTimeSpecs);
61-
}
62-
VariableSpecs variableSpecs = null;
63-
if (rep.exportVariableSpecs!=null) {
64-
variableSpecs = variableSpecsFromJsonRep(rep.exportVariableSpecs);
65-
}
6658
HumanReadableExportData humanReadableExportData1 = null;
6759
if (rep.exportHumanReadableDataSpec!=null){
6860
humanReadableExportData1 = humanReadableExportDataFromJsonRep(rep.exportHumanReadableDataSpec);
6961
}
7062
ExportEvent event = new ExportEvent(
7163
eventSource, rep.jobid, user,
7264
rep.dataIdString, new KeyValue(rep.dataKey), ExportEnums.ExportProgressType.getExportProgressType(rep.eventType),
73-
rep.format, rep.location, rep.progress,
74-
timeSpecs, variableSpecs);
65+
rep.format, rep.location, rep.progress);
7566
event.setHumanReadableExportData(humanReadableExportData1);
7667
return event;
7768
}
7869

7970
public static ExportEventRepresentation exportEventToJsonRep(ExportEvent event) {
8071
ExportTimeSpecs exportTimeSpecs = null;
81-
if (event.getTimeSpecs()!=null) {
82-
exportTimeSpecs = exportTimeSpecsToJsonRep(event.getTimeSpecs());
83-
}
8472
ExportVariableSpecs exportVariableSpecs = null;
85-
if (event.getVariableSpecs()!=null) {
86-
exportVariableSpecs = variableSpecsToJsonRep(event.getVariableSpecs());
87-
}
8873
ExportHumanReadableDataSpec exportHumanReadableDataSpec = null;
8974
if (event.getHumanReadableData() != null){
9075
exportHumanReadableDataSpec = humanReadableExportDataToJsonRep(event.getHumanReadableData());

vcell-apiclient/src/main/java/org/vcell/api/messaging/LocalDataSetControllerMessaging.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public ExportEvent makeRemoteFile(OutputContext outputContext,ExportSpecs export
308308
// N5 export is handled by the N5ExportService
309309
try {
310310
long jobID = vCellApiClient.getExportApi().exportN5(DtoModelTransforms.n5ExportRequestFromExportSpecs(exportSpecs));
311-
return new ExportEvent(this, jobID, null, exportSpecs.getVCDataIdentifier(), ExportEnums.ExportProgressType.EXPORT_START, exportSpecs.getFormat().name(), "", 0.0, exportSpecs.getTimeSpecs(), exportSpecs.getVariableSpecs());
311+
return new ExportEvent(this, jobID, null, exportSpecs.getVCDataIdentifier(), ExportEnums.ExportProgressType.EXPORT_START, exportSpecs.getFormat().name(), "", 0.0);
312312
} catch (ApiException e) {
313313
ExceptionHandler.onlyDataAccessOrPermissionException(e);
314314
throw new RuntimeException("Error should not reach here: " + e.getMessage(), e);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*/
1010

1111
package org.vcell.api.server;
12+
import java.time.Instant;
13+
import java.time.OffsetDateTime;
1214
import java.util.List;
1315
import java.util.Set;
1416
import java.util.concurrent.ScheduledExecutorService;
@@ -70,6 +72,7 @@ public class AsynchMessageManager implements AsyncMessageManagerInterface {
7072
private long pollTime = BASE_POLL_SECONDS;
7173
private AtomicBoolean bPoll = new AtomicBoolean(false);
7274
private ScheduledFuture<?> pollingHandle = null;
75+
private OffsetDateTime lastPoll = OffsetDateTime.now();
7376
/**
7477
* for {@link #schedule(long)} method
7578
*/
@@ -140,9 +143,10 @@ private void poll( ) {
140143
pollTime = BASE_POLL_SECONDS;
141144
queuedEvents = clientServerManager.getMessageEvents();
142145
try{
143-
Set<org.vcell.restclient.model.ExportEvent> setOfExports = clientServerManager.getVCellApiClient().getExportApi().exportStatus();
146+
List<org.vcell.restclient.model.ExportEvent> setOfExports = clientServerManager.getVCellApiClient().getExportApi().exportStatus(lastPoll);
144147
List<ExportEvent> exportEvents = setOfExports.stream().map(DtoModelTransforms::dtoToExportEvent).toList();
145148
queuedEvents = Stream.concat(exportEvents.stream(), Stream.of(queuedEvents)).toArray(MessageEvent[]::new);
149+
lastPoll = OffsetDateTime.now();
146150
} catch (ApiException ex){
147151
throw ExceptionHandler.getProperException(ex);
148152
}

vcell-client/src/main/java/cbit/vcell/client/ClientRequestManager.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,6 @@ private static void updateExportMetaData(final ExportEvent exportEvent){
26742674

26752675
HumanReadableExportData humanReadableExportData = exportEvent.getHumanReadableData();
26762676
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
2677-
double[] exportTimes = exportEvent.getTimeSpecs().getAllTimes();
26782677

26792678

26802679
if (jsonFile.exists()){
@@ -2699,8 +2698,8 @@ private static void updateExportMetaData(final ExportEvent exportEvent){
26992698
humanReadableExportData.simulationName,
27002699
humanReadableExportData.applicationName,
27012700
humanReadableExportData.biomodelName,
2702-
Arrays.toString(exportEvent.getVariableSpecs().getVariableNames()),
2703-
exportTimes[exportEvent.getTimeSpecs().getBeginTimeIndex()] + "/" + exportTimes[exportEvent.getTimeSpecs().getEndTimeIndex()],
2701+
null,
2702+
null,
27042703
humanReadableExportData.differentParameterValues,
27052704
humanReadableExportData.serverSavedFileName,
27062705
humanReadableExportData.applicationType,

0 commit comments

Comments
 (0)