Fabric Decorator Class

Source: Internet
Author: User

1. Calling methods
From fabric import Hosts,roles,runs_once,with_settings,task,serial,parallel

2. Use of adorners:
(1) @hosts (ip1,ip2,...) #类似于env. Hosts, except that it only works on the classes it modifies.

(2) @roles (identity 1, Identity 2) #当用env. roledefs={identity 1:[ip list], ...} Once defined, you can use the roles decorator to select the IP list you want to execute.

(3) @with_settings (env variable = value,...) #它的用法和with settings (): Same, the only difference is that its scope is the whole method

(4) @task #当执行fab-F file name-L, the execution results list all the method names in the file, but if @task is added, the result of fab-f file name-L is only the method name modified by @task

(5) @serial #用串行的方式执行 (that is, when one host completes, another host is executed)

(6) @parallel (pool_size=??) #用并行的方式执行, Pool_size sets the maximum number of parallel

This article from "My Sky" blog, declined reprint!

Fabric Decorator Class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.