def delete_vertex(self, id): this_object = self._validated_vertex_id(id) if this_object is None: raise ResourceNotFoundException() else: self._do_next(self.g.V(this_object).drop())
def get_inbound(self, id, search_depth=DEFAULT_SEARCH_DEPTH): this_object = self._validated_vertex_id(id) if this_object is None: raise ResourceNotFoundException(f"Unable to resolve Object {id}") else: return _format_graph_results( self._depth_search(this_object, __.inE(), search_depth))
def get_glue_job_status(job_name, run_id): glue_client = _get_glue_client() try: response = glue_client.get_job_run(JobName=job_name, RunId=run_id) if response is not None: return _extract_glue_job_status(response['JobRun']) except glue_client.exceptions.EntityNotFoundException: raise ResourceNotFoundException("Unable to resolve Job Name or Run ID")
def get_running_export_jobs(job_name): glue_client = _get_glue_client() response = glue_client.get_job_runs(JobName=job_name) if response is None: raise ResourceNotFoundException( f"Unable to resolve Job Name {job_name}") else: running = [] if 'JobRuns' in response: for j in response['JobRuns']: status = j['JobRunState'] if not any(x in status for x in ['STARTING', 'RUNNING', 'STOPPING']): pass else: running.append(_extract_glue_job_status(j)) return running
def setup_graph_method(self, *args, **kwargs): # lazy load the graph traverser if self._url is not None and self.g is None: n = Neptune() try: self.g = n.graphTraversal( neptune_endpoint=self._url, neptune_port=self._port, retry_limit=self._connection_retries if self._connection_retries is not None else params.DEFAULT_RETRY_COUNT) except Exception as e: log.error(e) raise ResourceNotFoundException( f"Unable to connect to Gremlin Endpoint {self._url}:{self._port}" ) print(f"Connected Gremlin Endpoint {self._url}:{self._port}") # return the decorated function return f(self, *args, **kwargs)