spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 崔苗(数据与人工智能产品开发部) <0049003...@znv.com>
Subject start spark code without applicatio.jar and submit
Date Fri, 02 Nov 2018 07:46:18 GMT
<html>
<head>
    <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
</head>
<body>
<style>
    font{
        line-height: 1.6;
    }
    ul,ol{
        padding-left: 20px;
        list-style-position: inside;
    }
</style>
<div style = 'font-family:微软雅黑,Verdana,&quot;Microsoft Yahei&quot;,SimSun,sans-serif;
line-height:1.6;'>
    <div ></div><div>
    <div>
        <span>
            <br>
        </span>
    </div>
    <div>
        <div style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft
Yahei', SimSun, sans-serif; line-height: 22.4px;">Hi,</div><div style="color:
rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif;
line-height: 22.4px;">we want to execute spark code with out submit application.jar,like
this code:</div><div style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana,
'Microsoft Yahei', SimSun, sans-serif; line-height: 22.4px;"><br></div><div
style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun,
sans-serif; line-height: 22.4px;">public static void main(String args[]) throws Exception{</div><div
style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun,
sans-serif; line-height: 22.4px;"></div><div style="color: rgb(49, 53, 59); font-family:
微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif; line-height: 22.4px;">&nbsp;
&nbsp; &nbsp; &nbsp; SparkSession spark = SparkSession</div><div style="color:
rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif;
line-height: 22.4px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; .builder()</div><div style="color: rgb(49, 53, 59); font-family:
微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif; line-height: 22.4px;">&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .master("local[*]")</div><div
style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun,
sans-serif; line-height: 22.4px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; .appName("spark test")</div><div style="color: rgb(49,
53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif; line-height:
22.4px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
.getOrCreate();</div><div style="color: rgb(49, 53, 59); font-family: 微软雅黑,
Verdana, 'Microsoft Yahei', SimSun, sans-serif; line-height: 22.4px;">&nbsp; &nbsp;
&nbsp;&nbsp;</div><div style="color: rgb(49, 53, 59); font-family: 微软雅黑,
Verdana, 'Microsoft Yahei', SimSun, sans-serif; line-height: 22.4px;">&nbsp; &nbsp;
&nbsp; &nbsp; Dataset&lt;Row&gt; testData = spark.read().csv(".\\src\\main\\java\\Resources\\no_schema_iris.scv");</div><div
style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun,
sans-serif; line-height: 22.4px;">&nbsp; &nbsp; &nbsp; &nbsp; testData.printSchema();</div><div
style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun,
sans-serif; line-height: 22.4px;">&nbsp; &nbsp; &nbsp; &nbsp; testData.show();</div><div
style="color: rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun,
sans-serif; line-height: 22.4px;">&nbsp; &nbsp; }</div><div style="color:
rgb(49, 53, 59); font-family: 微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif;
line-height: 22.4px;"><br></div><div style="color: rgb(49, 53, 59); font-family:
微软雅黑, Verdana, 'Microsoft Yahei', SimSun, sans-serif; line-height: 22.4px;">the
above code can work well with idea , do not need to generate jar file and submit , but if
we replace&nbsp;<span style="line-height: 22.4px;">master("local[*]") with&nbsp;</span><span
style="line-height: 22.4px;">master("yarn") , it can't work , so is there a way to use
cluster sparkSession like local sparkSession ? &nbsp;we need to dynamically execute spark
code in web server according to the different request , &nbsp;such as filter request will
call dataset.filter() , so there is no application.jar to submit .</span></div><span>
            
        </span>
    </div>
    <div id="ntes-pcmac-signature" style="font-family:'微软雅黑'">
     
    <div style="font-size:14px; padding: 0;  margin:0;line-height:14px;">
        <div style="padding-bottom:6px;margin-bottom:10px;border-bottom:1px solid #e6e6e6;display:inline-block;">
                    <a href="https://maas.mail.163.com/dashi-web-extend/html/proSignature.html?ftlId=1&amp;name=0049003208&amp;uid=0049003208%40znv.com&amp;iconUrl=https%3A%2F%2Fmail-online.nosdn.127.net%2Fqiyelogo%2FdefaultAvatar.png&amp;items=%5B%220049003208%40znv.com%22%5D"
style="display:block;background:#fff; max-width: 400px; _width: 400px;padding:15px 0 10px
0;text-decoration: none; outline:none;-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:none
!important;text-size-adjust:none !important;">
            <table cellpadding="0" style="width: 100%; max-width: 100%; table-layout: fixed;
border-collapse: collapse;color: #9b9ea1;font-size: 14px;line-height:1.3;-webkit-text-size-adjust:none
!important;text-size-adjust:none !important;">
                <tbody style="font-family: 'PingFang SC', 'Hiragino Sans GB','WenQuanYi
Micro Hei', 'Microsoft Yahei', '微软雅黑', verdana !important; word-wrap:break-word; word-break:break-all;-webkit-text-size-adjust:none
!important;text-size-adjust:none !important;">
                    <tr class="firstRow">
                            <td width="38" style="padding:0; box-sizing: border-box; width:
38px;">
                                <img width="38" height="38" style="vertical-align:middle;
width: 38px; height: 38px; border-radius:50%;" src="https://mail-online.nosdn.127.net/qiyelogo/defaultAvatar.png">
                            </td>
                            <td style="padding: 0 0 0 10px; color: #31353b;">
                                <div style="font-size: 16px;font-weight:bold; width:100%;
white-space: nowrap; overflow:hidden;text-overflow: ellipsis;">0049003208</div>
                            </td>
                    </tr>
                        <tr width="100%" style="font-size: 14px !important; width: 100%;">
                            <td colspan="2" style="padding:10px 0 0 0; font-size:14px !important;
width: 100%;">
                                    <div style="width: 100%;font-size: 14px !important;word-wrap:break-word;word-break:break-all;">0049003208@znv.com</div>
                            </td>
                        </tr>
                </tbody>
            </table>
        </a>
        </div>
    </div>
    <div style="font-size:12px;color:#b5b9bd;line-height:18px;">
        <span>签名由</span>
        <a style="text-decoration: none;color:#4196ff;padding:0 5px;" href="https://mail.163.com/dashi/dlpro.html?from=mail81">网易邮箱大师</a>
        <span>定制</span>
    </div>
 </div>
</div><!--😀-->
</div>
</body>
</html>
Mime
View raw message