Set attributes
1. pg_id: process group id
2. bucket_name: bucket name
3. flow_name: flow name
4. target_version: latest(str) or version number(int)
ef2c1d9a-0168-1000-ffff-ffffdce527c8
VersioningUpdateFlowVer
b8139c32-681d-3dc5-0000-000000000000
7290729c-5cae-35dc-0000-000000000000
0.0
0.0
设置属性
1. pg_id: 组的id
2. bucket_name: bucket名字
3. flow_name: flow名字
4. target_version: 目标版本号;数字或latest,默认最新latest
1548e8d0-04cf-3398-0000-000000000000
b8139c32-681d-3dc5-0000-000000000000
93f5c464-4157-380a-a87a-1146e4a494fb
1 GB
10000
b8139c32-681d-3dc5-0000-000000000000
e3f3c2df-8fc7-3252-0000-000000000000
PROCESSOR
323a6388-963c-3ae7-9fb3-c734b9afc83b
0 sec
1
DO_NOT_COMPRESS
LOAD_BALANCE_NOT_CONFIGURED
DO_NOT_LOAD_BALANCE
success
0
8dab0e94-6eb5-37b6-0000-000000000000
b8139c32-681d-3dc5-0000-000000000000
c1ab800a-87c3-30a0-a107-6a2caedbeefc
1 GB
10000
b8139c32-681d-3dc5-0000-000000000000
e0bc9898-7dfb-3992-0000-000000000000
PROCESSOR
fd397dec-5fd5-3fe2-86e5-a1bc053ccf79
0 sec
1
DO_NOT_COMPRESS
LOAD_BALANCE_NOT_CONFIGURED
DO_NOT_LOAD_BALANCE
success
0
e0bc9898-7dfb-3992-0000-000000000000
b8139c32-681d-3dc5-0000-000000000000
380.9999978504111
352.999984892469
fd397dec-5fd5-3fe2-86e5-a1bc053ccf79
nifi-standard-nar
org.apache.nifi
1.8.0
WARN
1
Command Arguments
Command Arguments
Command Path
Command Path
Ignore STDIN
Ignore STDIN
Working Directory
Working Directory
Argument Delimiter
Argument Delimiter
Output Destination Attribute
Output Destination Attribute
Max Attribute Length
Max Attribute Length
ALL
false
30 sec
Command Arguments
${filename} --pg_id ${pg_id} --bucket_name ${bucket_name} --flow_name ${flow_name} --target_version ${target_version}
Command Path
python3
Ignore STDIN
false
Working Directory
/tmp
Argument Delimiter
Output Destination Attribute
Max Attribute Length
256
0
0 sec
TIMER_DRIVEN
1 sec
false
ExecuteStreamCommand
true
nonzero status
true
original
true
output stream
DISABLED
org.apache.nifi.processors.standard.ExecuteStreamCommand
e3f3c2df-8fc7-3252-0000-000000000000
b8139c32-681d-3dc5-0000-000000000000
832.9999978504111
153.999984892469
323a6388-963c-3ae7-9fb3-c734b9afc83b
nifi-standard-nar
org.apache.nifi
1.8.0
WARN
1
Directory
Directory
Conflict Resolution Strategy
Conflict Resolution Strategy
Create Missing Directories
Create Missing Directories
Maximum File Count
Maximum File Count
Last Modified Time
Last Modified Time
Permissions
Permissions
Owner
Owner
Group
Group
PRIMARY
false
30 sec
Directory
/tmp
Conflict Resolution Strategy
replace
Create Missing Directories
false
Maximum File Count
Last Modified Time
Permissions
777
Owner
Group
0
0 sec
TIMER_DRIVEN
1 sec
false
PutFile
true
failure
false
success
DISABLED
org.apache.nifi.processors.standard.PutFile
fcabf483-1159-381f-0000-000000000000
b8139c32-681d-3dc5-0000-000000000000
378.9999978504111
152.999984892469
42f33070-c900-396f-bd63-b5c32e3afc35
nifi-standard-nar
org.apache.nifi
1.8.0
WARN
1
File Size
File Size
Batch Size
Batch Size
Data Format
Data Format
Unique FlowFiles
Unique FlowFiles
generate-ff-custom-text
generate-ff-custom-text
character-set
character-set
bucket_name
bucket_name
filename
filename
flow_name
flow_name
pg_id
pg_id
target_version
target_version
PRIMARY
false
30 sec
File Size
0B
Batch Size
1
Data Format
Text
Unique FlowFiles
false
generate-ff-custom-text
import argparse
import nipyapi
nipyapi.config.nifi_config.host = 'http://datacenter2:18881/nifi-api'
nipyapi.config.registry_config.host = 'http://datacenter2:19090/nifi-registry-api'
#Queues can be large - increase timeout
nipyapi.config.short_max_wait = 3600
parser = argparse.ArgumentParser()
parser.add_argument('--pg_id', default=None)
parser.add_argument('--bucket_name', default=None)
parser.add_argument('--flow_name', default=None)
parser.add_argument('--target_version', default=None)
args = parser.parse_args()
pg_id=args.pg_id
bucket_name=args.bucket_name
flow_name=args.flow_name
target_version=args.target_version
if target_version == 'latest':
target_version = None
else:
target_version = int(target_version)
def update_flow_ver(pg_id, bucket_name, flow_name, target_version=None):
bucket = nipyapi.versioning.get_registry_bucket(identifier=bucket_name, identifier_type='name')
flow = nipyapi.versioning.get_flow_in_bucket(bucket_id=bucket.identifier, identifier=flow_name, identifier_type='name')
pgs = nipyapi.canvas.list_all_process_groups(pg_id=pg_id)
total = len(pgs)
i = 0
for pg in pgs:
i += 1
ver_info = pg.component.version_control_information
if ver_info and ver_info.flow_id == flow.identifier:
nipyapi.versioning.update_flow_ver(pg, target_version)
print('--- [%s] updated, i=%d, total=%d' % (pg.component.name, i, total))
print('Done.')
return None
if __name__ == '__main__':
update_flow_ver(pg_id, bucket_name, flow_name, target_version)
character-set
UTF-8
bucket_name
test
filename
tmp_nifi_update_flow_ver.py
flow_name
test
pg_id
ef2c1d9a-0168-1000-ffff-ffffdce527c8
target_version
latest
0
11111111111111111 day
TIMER_DRIVEN
1 sec
false
设置所有自定义属性,除了filename
false
success
DISABLED
org.apache.nifi.processors.standard.GenerateFlowFile
VersioningUpdateFlowVer
05/13/2019 17:15:41 CST