使用REST触发Spark作业

编程入门 行业动态 更新时间:2024-10-27 06:27:30
本文介绍了使用REST触发Spark作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近尝试了 apache spark .我的问题是更具体地触发火花作业. 这里我已经发布了有关了解火花工作的问题.在忙于工作之后,我继续着自己的要求.

I have been of late trying out apache spark. My question is more specific to trigger spark jobs. Here I had posted question on understanding spark jobs. After getting dirty on jobs I moved on to my requirement.

我有一个REST端点,在这里我公开API来触发Jobs,我已经将Spring4.0用于Rest实施.现在,我想到了在Spring中实现Jobs as Service的工作,我将以编程方式提交Job,这意味着当端点触发时,使用给定的参数,我将触发该Job. 我现在有几个设计选项.

I have a REST end point where I expose API to trigger Jobs, I have used Spring4.0 for Rest Implementation. Now going ahead I thought of implementing Jobs as Service in Spring where I would submit Job programmatically, meaning when the endpoint is triggered, with given parameters I would trigger the job. I have now few design options.

  • 类似于下面的书面工作,我需要维护几个由抽象类调用的Jobs可能是JobScheduler.

/*Can this Code be abstracted from the application and written as as a seperate job. Because my understanding is that the Application code itself has to have the addJars embedded which internally sparkContext takes care.*/ SparkConf sparkConf = new SparkConf().setAppName("MyApp").setJars( new String[] { "/path/to/jar/submit/cluster" }) .setMaster("/url/of/master/node"); sparkConf.setSparkHome("/path/to/spark/"); sparkConf.set("spark.scheduler.mode", "FAIR"); JavaSparkContext sc = new JavaSparkContext(sparkConf); sc.setLocalProperty("spark.scheduler.pool", "test"); // Application with Algorithm , transformations

  • 延伸到上述位置的文件具有由服务处理的多个版本的作业.

  • extending above point have multiple versions of jobs handled by service.

    或者使用Spark Job Server来执行此操作.

    Or else use an Spark Job Server to do this.

    首先,我想知道在这种情况下最佳的解决方案是明智的执行方式,同时还要明智地进行扩展.

    Firstly, I would like to know what is the best solution in this case, execution wise and also scaling wise.

    注意:我正在使用Spark的独立群集. 请帮忙.

    Note : I am using a standalone cluster from spark. kindly help.

    推荐答案

    只需使用Spark JobServer github/spark-jobserver/spark-jobserver

    Just use the Spark JobServer github/spark-jobserver/spark-jobserver

    进行服务时要考虑很多事情,Spark JobServer已经涵盖了其中的大部分内容.如果您发现事情还不够好,那么发出请求并将代码添加到他们的系统中应该很容易,而不是从头开始重新发明它

    There are a lot of things to consider with making a service, and the Spark JobServer has most of them covered already. If you find things that aren't good enough, it should be easy to make a request and add code to their system rather than reinventing it from scratch

  • 更多推荐

    使用REST触发Spark作业

    本文发布于:2023-11-24 03:14:10,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1623766.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:作业   REST   Spark

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!