Skip to content

Commit

Permalink
Cleanup all redondant status storage
Browse files Browse the repository at this point in the history
  • Loading branch information
gschwind committed Sep 15, 2023
1 parent 02d947e commit 2cf0e95
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
18 changes: 0 additions & 18 deletions pywps/app/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def from_json(cls, value):

def execute(self, wps_request, uuid):
self._set_uuid(uuid)
self._setup_status_storage()
self.async_ = False
wps_response = WPSExecuteResponse(self, wps_request, self.uuid)

Expand Down Expand Up @@ -165,23 +164,6 @@ def _set_uuid(self, uuid):
for outpt in self.outputs:
outpt.uuid = uuid

def _setup_status_storage(self):
self._status_store = StorageBuilder.buildStorage()

@property
def status_store(self):
if self._status_store is None:
self._setup_status_storage()
return self._status_store

@property
def status_location(self):
return self.status_store.location(self.status_filename)

@property
def status_filename(self):
return str(self.uuid) + '.xml'

@property
def status_url(self):
base_url = config.get_config_value('server', 'url')
Expand Down
26 changes: 1 addition & 25 deletions pywps/app/WPSExecuteResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ def _update_status(self, status, message, status_percentage, clean=True):
self.wps_request.preprocess_response = None

LOGGER.debug("_update_status: status={}, clean={}".format(status, clean))
self._update_status_doc()
if self.store_status_file:
self._update_status_file()
if clean:
if self.status == WPS_STATUS.SUCCEEDED or self.status == WPS_STATUS.FAILED:
LOGGER.debug("clean workdir: status={}".format(status))
Expand All @@ -145,26 +142,6 @@ def update_status(self, message, status_percentage=None):
status_percentage = self.status_percentage
self._update_status(self.status, message, status_percentage, False)

def _update_status_doc(self):
try:
# rebuild the doc
self.doc = StatusResponse(self.wps_request.version, self.uuid,
get_default_response_mimetype()).get_data(as_text=True)
self.content_type = get_default_response_mimetype()
except Exception as e:
raise NoApplicableCode('Building Response Document failed with : {}'.format(e))

def _update_status_file(self):
# TODO: check if file/directory is still present, maybe deleted in mean time
try:
# update the status xml file
self.process.status_store.write(
self.doc,
self.process.status_filename,
data_format=FORMATS.XML)
except Exception as e:
raise NoApplicableCode('Writing Response Document failed with : {}'.format(e))

def _process_accepted(self):
percent = int(self.status_percentage)
if percent > 99:
Expand Down Expand Up @@ -233,8 +210,7 @@ def as_json_for_execute_template(self):
}

if self.store_status_file:
if self.process.status_location:
data["status_location"] = self.process.status_url
data["status_location"] = self.process.status_url

if self.status == WPS_STATUS.ACCEPTED:
self.message = 'PyWPS Process {} accepted'.format(self.process.identifier)
Expand Down

0 comments on commit 2cf0e95

Please sign in to comment.