doc-exports/docs/fg/umn/functiongraph_01_0152.html
Chen, Junjie dac566cf2f FG UMN 20230725 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: Chen, Junjie <chenjunjie@huawei.com>
Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
2024-04-03 10:30:56 +00:00

174 lines
34 KiB
HTML

<a name="functiongraph_01_0152"></a><a name="functiongraph_01_0152"></a>
<h1 class="topictitle1">Creating a Deployment Package</h1>
<div id="body32001227"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p14741017183748">To create a function, you must create a deployment package which includes your code and all dependencies. You can create a deployment package locally or edit code on the FunctionGraph console. If you edit code inline, FunctionGraph automatically creates and uploads a deployment package for your function. FunctionGraph allows you to edit function code in the same way as managing a project. You can create and edit files and folders. After you upload a ZIP code package, you can view and edit the code on the console.</p>
<div class="note" id="functiongraph_01_0152__en-us_topic_0000001251588476_note13719413231"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul115391124103414"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li653914249342">After programming, simply package your code into a ZIP file (Java, Node.js, Python, and Go) or JAR file (Java), and upload the file to FunctionGraph for execution.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li6689526163415">When creating a ZIP file, place the handler file under the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1191210237197">root</strong> directory to ensure that your code can run normally after being decompressed.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li379110287345">If you edit code in Go, zip the compiled file, and ensure that the name of the dynamic library file is consistent with the plug-in name of the handler. For example, if the name of the dynamic library file is <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1254065716105710">testplugin.so</strong>, set the handler name to <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1488974272105710">testplugin.Handler</strong>.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li12103805165430">Java is a compiled language, which does not support editing code inline. If your function does not use any third-party dependencies, you can upload a function JAR file. If your function uses third-party dependencies, compress the dependencies and the function JAR file into a ZIP file, and then upload the ZIP file.</li></ul>
</div></div>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p8060118"><a href="#functiongraph_01_0152__en-us_topic_0000001251588476_table35034283164337">Table 1</a> lists the code entry modes supported by FunctionGraph for each runtime.</p>
<div class="tablenoborder"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_table35034283164337"></a><a name="en-us_topic_0000001251588476_table35034283164337"></a><table cellpadding="4" cellspacing="0" summary="" id="functiongraph_01_0152__en-us_topic_0000001251588476_table35034283164337" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Code entry modes</caption><thead align="left"><tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row14394085164337"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.6.1.1"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p923246164344">Runtime</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.6.1.2"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p7674122164344">Editing Code Inline</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.6.1.3"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p17624179164344">Uploading a ZIP File</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.6.1.4"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p18272400164344">Uploading a JAR File</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.6.1.5"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p3669450164344">Uploading a ZIP File from OBS</p>
</th>
</tr>
</thead>
<tbody><tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row12955950164337"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p50290611164344"><a href="#functiongraph_01_0152__en-us_topic_0000001251588476_section19628123822418">Node.js</a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.2 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p47007666164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.3 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p49524590164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.4 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p52068814164344">Not supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.5 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p56824378164344">Supported</p>
</td>
</tr>
<tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row12417485164337"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p18803067164344"><a href="#functiongraph_01_0152__en-us_topic_0000001251588476_section4865310182816">Python</a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.2 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p46653478164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.3 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p20835386164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.4 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p9944669164344">Not supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.5 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p211898164344">Supported</p>
</td>
</tr>
<tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row6706927164337"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p20256177164344"><a href="#functiongraph_01_0152__en-us_topic_0000001251588476_section14790124217354">Java</a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.2 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p30137634164344">Not supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.3 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p25229255164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.4 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p30303752164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.5 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p38684879164344">Supported</p>
</td>
</tr>
<tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row56867807164337"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p15553935164344"><a href="#functiongraph_01_0152__en-us_topic_0000001251588476_section1980313817362">Go</a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.2 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p51909199164344">Not supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.3 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p43895600164344">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.4 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p65882713164344">Not supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.5 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p34899571164344">Supported</p>
</td>
</tr>
<tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row1843015152419"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p8431121513417"><a href="#functiongraph_01_0152__en-us_topic_0000001251588476_section166121748658">Custom runtime</a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.2 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p711511336420">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.3 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p111156331945">Supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.4 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p111156331944">Not supported</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.6.1.5 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p4116113315410">Supported</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="notice" id="functiongraph_01_0152__en-us_topic_0000001251588476_note1565520111610"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p76555111563">If the code to be uploaded contains sensitive information (such as account passwords), encrypt the sensitive information to prevent leakage.</p>
</div></div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="functiongraph_01_0152__en-us_topic_0000001251588476_table1742559193710" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Code entry modes</caption><thead align="left"><tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row8751155918379"><th align="left" class="cellrowborder" valign="top" width="19.7%" id="mcps1.3.6.2.3.1.1"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1875195914372">Code Entry Mode</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="80.30000000000001%" id="mcps1.3.6.2.3.1.2"><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1775835923720">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row37581259163715"><td class="cellrowborder" valign="top" width="19.7%" headers="mcps1.3.6.2.3.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1075810590373">Edit code inline</p>
</td>
<td class="cellrowborder" valign="top" width="80.30000000000001%" headers="mcps1.3.6.2.3.1.2 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p85985422813">FunctionGraph allows you to edit function code in the same way as managing a project. You can create and edit files and folders. After you upload a ZIP code package, you can edit the code on the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b358992518325">Code</strong> tab of the function details page.</p>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul571217915502"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li18961327145016"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b9809134215337">File</strong>: Create files and folders, save changes, and close all files.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li137121191508"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1469316348374">Edit</strong>: Undo/redo typing; cut, copy, and paste code; find and replace content.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li8712182011114"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b4127219104017">Settings</strong>: Set the font size, auto formatting, and theme color.</li></ul>
</td>
</tr>
<tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row1876575917374"><td class="cellrowborder" valign="top" width="19.7%" headers="mcps1.3.6.2.3.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p10765359143719">Upload ZIP file</p>
</td>
<td class="cellrowborder" valign="top" width="80.30000000000001%" headers="mcps1.3.6.2.3.1.2 "><ol id="functiongraph_01_0152__en-us_topic_0000001251588476_ol913025510572"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li5181116583">On the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b813733614118">Code</strong> tab of the function details page, choose <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b36071436184216">Upload</strong> &gt; <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b434993924216">Local ZIP</strong>.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1991818474586">Click <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b3420194744215">Select File</strong> and upload a local code package to FunctionGraph. The size of the ZIP file cannot exceed 40 MB. For a larger file, upload it through OBS.</li></ol>
</td>
</tr>
<tr id="functiongraph_01_0152__en-us_topic_0000001251588476_row13765359183720"><td class="cellrowborder" valign="top" width="19.7%" headers="mcps1.3.6.2.3.1.1 "><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p776595953710">Upload file from OBS</p>
</td>
<td class="cellrowborder" valign="top" width="80.30000000000001%" headers="mcps1.3.6.2.3.1.2 "><ol id="functiongraph_01_0152__en-us_topic_0000001251588476_ol1266685915387"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li4667175943811">On the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b16793141634415">Code</strong> tab of the function details page, choose <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b279314161448">Upload</strong> &gt; <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b479341694412">OBS ZIP</strong>.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li19667155993815">Click <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b105579261448">Select File</strong> and upload a local code package to FunctionGraph.</li></ol>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="functiongraph_01_0152__en-us_topic_0000001251588476_section19628123822418"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_section19628123822418"></a><a name="en-us_topic_0000001251588476_section19628123822418"></a><h4 class="sectiontitle">Node.js</h4><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1050354014246"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b852345062413">Editing Code Inline</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p13683551907">FunctionGraph provides an SDK for editing code in Node.js. If your custom code uses only the SDK library, you can edit code using the inline editor on the FunctionGraph console. After you edit code inline and upload it to FunctionGraph, the console compresses your code and the related configurations into a deployment package that FunctionGraph can run.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p15198154962513"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b3194429172918">Uploading a Deployment Package</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p4893920113913">If your code uses other resources, such as a graphic library for image processing, first create a deployment package, and then upload the package to the FunctionGraph console. You can upload a Node.js deployment package in two ways.</p>
<div class="notice" id="functiongraph_01_0152__en-us_topic_0000001251588476_note1224412330393"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul1844071453713"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1098811258376">When creating a ZIP file, place the handler file under the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1589651033105710">root</strong> directory to ensure that your code can run normally after being decompressed.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li86901146192810">The size of the decompressed source code cannot exceed 1.5 GB. If the code is too large, contact the customer service.</li></ul>
</div></div>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul6548294619534"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1158941519534">Directly uploading a local deployment package<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1261151425920"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_li1158941519534"></a><a name="en-us_topic_0000001251588476_li1158941519534"></a>After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1877530919542">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li55707719537">Uploading a deployment package using an OBS bucket<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p157632166591"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_li55707719537"></a><a name="en-us_topic_0000001251588476_li55707719537"></a>After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p56798904191115">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li></ul>
</div>
<div class="section" id="functiongraph_01_0152__en-us_topic_0000001251588476_section4865310182816"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_section4865310182816"></a><a name="en-us_topic_0000001251588476_section4865310182816"></a><h4 class="sectiontitle">Python</h4><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p9303101262816"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b28521928152818">Editing Code Inline</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p892134411280">FunctionGraph provides an SDK for editing code in Python. If your custom code uses only the SDK library, you can edit code using the inline editor on the FunctionGraph console. After you edit code inline and upload it to FunctionGraph, the console compresses your code and the related configurations into a deployment package that FunctionGraph can run.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p106931470287"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1692853619345">Uploading a Deployment Package</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p24035292290">If your code uses other resources, such as a graphic library for image processing, first create a deployment package, and then upload the package to the FunctionGraph console. You can upload a Python deployment package in two ways.</p>
<div class="notice" id="functiongraph_01_0152__en-us_topic_0000001251588476_note7403122932918"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul710518341816"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li13105638187">When creating a ZIP file, place the handler file under the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b142271620132410">root</strong> directory to ensure that your code can run normally after being decompressed.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li12586173603819">The size of the decompressed source code cannot exceed 1.5 GB. If the code is too large, contact the customer service.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li15168191141813">When you write code in Python, do not name your package with the same suffix as a standard Python library, such as <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b5529116103015">json</strong>, <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b5736717133016">lib</strong>, and <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b2649419163016">os</strong>. Otherwise, an error indicating a module loading failure will be reported.</li></ul>
</div></div>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul135195573411"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534">Directly uploading a local deployment package<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1261151425920"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534"></a>After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1877530919542">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537">Uploading a deployment package using an OBS bucket<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p157632166591"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537"></a>After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p56798904191115">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li></ul>
</div>
<div class="section" id="functiongraph_01_0152__en-us_topic_0000001251588476_section14790124217354"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_section14790124217354"></a><a name="en-us_topic_0000001251588476_section14790124217354"></a><h4 class="sectiontitle">Java</h4><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1977164420358">Java is a compiled language, which does not support editing code inline. You can only upload a local deployment package, which can be a ZIP or JAR file.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1417818943716"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1040566991163255">Uploading a JAR File</strong></p>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul1837219421392"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1937284213398">If your function does not use any dependencies, directly upload a JAR file.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li663344563910">If your function uses dependencies, upload them to an OBS bucket, set them during function creation, and upload the JAR file.</li></ul>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p20812517123715"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b741807370163752">Uploading a ZIP File</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p17292535192233">If your function uses third-party dependencies, compress the dependencies and the function JAR file into a ZIP file, and then upload the ZIP file. </p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p9196163812388">You can upload a Java deployment package in two ways.</p>
<div class="notice" id="functiongraph_01_0152__en-us_topic_0000001251588476_note319683803818"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0149027319_ul1844071453713"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0149027319_li1098811258376">When creating a ZIP file, place the handler file under the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b659110102217">root</strong> directory to ensure that your code can run normally after being decompressed.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0149027319_li86901146192810">The size of the decompressed source code cannot exceed 1.5 GB. If the code is too large, contact the customer service.</li></ul>
</div></div>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul18204938113818"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_1">Directly uploading a local deployment package<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1261151425920_1"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_1"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_1"></a>After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1877530919542_1">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_1">Uploading a deployment package using an OBS bucket<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p157632166591_1"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_1"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_1"></a>After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p56798904191115_1">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li></ul>
</div>
<div class="section" id="functiongraph_01_0152__en-us_topic_0000001251588476_section1980313817362"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_section1980313817362"></a><a name="en-us_topic_0000001251588476_section1980313817362"></a><h4 class="sectiontitle">Go</h4><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p2679201110368"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b162555030316402">Uploading a Deployment Package</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p13890105713393">You can only upload a Go deployment package in ZIP format. There are two ways to upload it.</p>
<div class="notice" id="functiongraph_01_0152__en-us_topic_0000001251588476_note12890135717397"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul03385394249"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li153382391242">When creating a ZIP file, place the handler file under the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b26653271110">root</strong> directory to ensure that your code can run normally after being decompressed.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1634063914249">The size of the decompressed source code cannot exceed 1.5 GB. If the code is too large, contact the customer service.</li></ul>
</div></div>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul266041815411"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_2">Directly uploading a local deployment package<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1261151425920_2"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_2"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_2"></a>After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1877530919542_2">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_2">Uploading a deployment package using an OBS bucket<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p157632166591_2"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_2"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_2"></a>After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p56798904191115_2">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li></ul>
</div>
<div class="section" id="functiongraph_01_0152__en-us_topic_0000001251588476_section166121748658"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_section166121748658"></a><a name="en-us_topic_0000001251588476_section166121748658"></a><h4 class="sectiontitle">Custom Runtime</h4><p id="functiongraph_01_0152__en-us_topic_0000001251588476_p19193141666"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1403203500">Editing Code Inline</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1691910148617">After you edit code inline and upload it to FunctionGraph, the console compresses your code and the related configurations into a deployment package that FunctionGraph can run.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p691915144611"><strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b1800118264">Uploading a Deployment Package</strong></p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_p1391901416617">If your code uses other resources, such as a graphic library for image processing, first create a deployment package, and then upload the package to the FunctionGraph console. You can upload a deployment package for a custom runtime in two ways.</p>
<div class="notice" id="functiongraph_01_0152__en-us_topic_0000001251588476_note199191141363"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul1135783912241"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1535763982412">When creating a ZIP file, place the handler file under the <strong id="functiongraph_01_0152__en-us_topic_0000001251588476_b36504375112">root</strong> directory to ensure that your code can run normally after being decompressed.</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_li1535863962416">The size of the decompressed source code cannot exceed 1.5 GB. If the code is too large, contact the customer service.</li></ul>
</div></div>
<ul id="functiongraph_01_0152__en-us_topic_0000001251588476_ul9920191420614"><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_3">Directly uploading a local deployment package<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1261151425920_3"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_3"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li1158941519534_3"></a>After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p1877530919542_3">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li><li id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_3">Uploading a deployment package using an OBS bucket<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p157632166591_3"><a name="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_3"></a><a name="en-us_topic_0000001251588476_en-us_topic_0000001251588476_li55707719537_3"></a>After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.</p>
<p id="functiongraph_01_0152__en-us_topic_0000001251588476_en-us_topic_0000001251588476_p56798904191115_3">For details about function resource restrictions, see section "Notes and Constraints".</p>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="functiongraph_01_0150_0.html">Building Functions</a></div>
</div>
</div>