def get(self, job_id): """Return information about a single job https://api.openeo.org/#operation/debug-job """ if job_id in self.job_db: job: JobInformation = self.job_db[job_id] job_logs = {'logs': [], 'links': []} # Check for the actinia id to get the latest actinia job # information if job_id in self.actinia_job_db: actinia_id = self.actinia_job_db[job_id] code, job_info = self.iface.resource_info( resource_id=actinia_id) if code == 200: # Add the actinia information to the openeo job if job.additional_info != job_info: job.additional_info = job_info job.updated = job_info["datetime"] if job_info["status"] == "finished": job.status = "finished" if job_info["status"] == "error": job.status = "error" if job_info["status"] == "accepted": job.status = "queued" if job_info["status"] == "terminated": job.status = "canceled" if job_info["status"] == "running": job.status = "running" # Store the updated job in the database self.job_db[job_id] = job else: if job.additional_info != job_info: job.additional_info = job_info self.job_db[job_id] = job links = [] if (job.additional_info['urls'] and "resources" in job.additional_info['urls']): resource_links = job.additional_info['urls']['resources'] for link in resource_links: eo_link = EoLink(href=link) links.append(eo_link) job_logs['logs'] = job job_logs['links'] = links return make_response(jsonify(job_logs), 200) else: return ErrorSchema( id="123456678", code=404, message=f"job with id {job_id} not found in database.").as_response( http_status=404)
def __init__(self, collections: List[CollectionEntry], links: Optional[List[EoLink]] = [ EoLink(href="http://www.mundialis.de", title="mundialis", rel="external"), ]): self.collections = collections self.links = links
def __init__( self, providers: Optional[CollectionProviders] = None, links: Optional[List[EoLink]] = [ EoLink(href="http://www.mundialis.de", title="mundialis", rel="external"), ], extent: Optional[CollectionExtent] = CollectionExtent(), title: str = None, description: str = None, license: str = "proprietary", stac_version: str = "0.6.2", id: str = None, version: str = None, keywords: List[str] = None, properties: Optional[CollectionProperties] = CollectionProperties( ), dimensions=None): self.title = title self.description = description self.license = license self.extent = extent self.links = links self.stac_version = stac_version # pattern = "^[A-Za-z0-9_\-\.~\/]+$" # x = re.search(pattern, id) # if not x: # es = ErrorSchema(id=str(datetime.now().isoformat()), code=400, # message="The id MUST match the following pattern: %s" % pattern) # return make_response(es.to_json(), 400) self.id = id self.keywords = keywords self.version = version self.providers = providers self.properties = properties if not dimensions: dimensions = { "x": { "type": "spatial", "axis": "x" }, "y": { "type": "spatial", "axis": "x" }, } self.cube___dimensions = dimensions # STAC Common Metadata: A list of commonly used fields throughout all domains # https://github.com/radiantearth/stac-spec/tree/v0.9.0/item-spec/common-metadata.md # Content Extensions: Domain-specific fields for domains such as EO, SAR and point clouds. # https://github.com/radiantearth/stac-spec/tree/v0.9.0/extensions/README.md#list-of-content-extensions self.summaries = {}
def get(self, job_id): """Return information about a single job https://open-eo.github.io/openeo-api/v/0.3.0/apireference/#tag/Job-Management/paths/~1jobs~1{job_id}/get """ if job_id in self.job_db: job: JobInformation = self.job_db[job_id] job.stac_version = CAPABILITIES['stac_version'] job.type = "Feature" job.geometry = "json:null" job.properties = dict() job.properties['datetime'] = None job.assets = dict() job.links = [] # Check for the actinia id to get the latest actinia job # information if job_id in self.actinia_job_db: actinia_id = self.actinia_job_db[job_id] code, job_info = self.iface.resource_info( resource_id=actinia_id) if code == 200: # Add the actinia information to the openeo job if job.additional_info != job_info: job.additional_info = job_info job.updated = job_info["datetime"].replace( " ", "T").replace("'", "").replace('"', '') if job_info["status"] == "finished": job.status = "finished" if job_info["status"] == "error": job.status = "error" if job_info["status"] == "accepted": job.status = "queued" if job_info["status"] == "terminated": job.status = "canceled" if job_info["status"] == "running": job.status = "running" # Store the updated job in the database self.job_db[job_id] = job else: if job.additional_info != job_info: job.additional_info = job_info self.job_db[job_id] = job if (job.additional_info['urls'] and "resources" in job.additional_info['urls']): resource_links = job.additional_info['urls']['resources'] if job.links is None: job.links = [] for link in resource_links: eo_link = EoLink(href=link) job.links.append(eo_link) return job.as_response(http_status=200) else: return ErrorSchema( id="123456678", code=404, message=f"job with id {job_id} not found in database." ).as_response(http_status=404)