示例#1
0
 def delete(self, sparkapp_name: str):
     service = SparkAppService()
     try:
         sparkapp_info = service.delete_sparkapp(sparkapp_name)
         return {'data': sparkapp_info.to_dict()}, HTTPStatus.OK
     except NotFoundException:
         return {'data': {'name': sparkapp_name}}, HTTPStatus.OK
示例#2
0
 def setUp(self) -> None:
     super().setUp()
     self._upload_path = os.path.join(BASE_DIR, 'test-spark')
     os.makedirs(self._upload_path)
     self._patch_upload_path = patch(
         'fedlearner_webconsole.sparkapp.service.UPLOAD_PATH',
         self._upload_path)
     self._patch_upload_path.start()
     self._sparkapp_service = SparkAppService()
示例#3
0
    def post(self):
        service = SparkAppService()
        data = request.json

        try:
            config = SparkAppConfig.from_dict(data)
            if config.files:
                config.files = base64.b64decode(config.files)
        except ValueError as err:
            raise InvalidArgumentException(details=err)

        res = service.submit_sparkapp(config=config)
        return {'data': res.to_dict()}, HTTPStatus.CREATED
示例#4
0
    def __init__(self, task_id: int) -> None:
        self.task_id = task_id
        self.task_type = None
        self.files_dir = None
        self.files_path = None
        self.main_application = None
        self.command = []
        self.sparkapp_name = None
        self.args = {}
        self.started = False
        self.error_msg = False

        self.spark_service = SparkAppService()
示例#5
0
 def get(self, sparkapp_name: str):
     service = SparkAppService()
     return {
         'data': service.get_sparkapp_info(sparkapp_name).to_dict()
     }, HTTPStatus.OK