@ThreadSafe public class AgentProcessContext extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
static String |
UPLOAD_SUBDIR |
Constructor and Description |
---|
AgentProcessContext(AlluxioConfiguration conf)
Creates a new instance of
AgentProcessContext . |
AgentProcessContext(AlluxioConfiguration conf,
RpcClient<ManagerAgentServiceGrpc.ManagerAgentServiceBlockingStub> client)
Creates a new instance of
AgentProcessContext . |
Modifier and Type | Method and Description |
---|---|
Set<AlluxioNodeType> |
alluxioProcesses() |
void |
changeState(AlluxioNodeType type,
ProcessStateChange action)
Attempts to change the state of a process.
|
void |
close() |
AlluxioConfigurationSet |
getConf()
Gets the configuration for the current node.
|
protected HubNodeAddress |
getNodeAddress() |
String |
getPropertyFromFile(PropertyKey key)
Get Property from file.
|
List<AgentListFileInfo> |
listFile()
List files.
|
boolean |
removeFile(String fileName,
UploadProcessType uploadProcessType)
Upload a file.
|
void |
restartPresto()
Restarts the local instance of presto on this node.
|
boolean |
updateConf(Properties props)
Update alluxio site property values.
|
boolean |
uploadFile(String filePath,
String permission,
com.google.protobuf.ByteString fileContent,
UploadProcessType uploadType)
Upload a file to the current node.
|
void |
writeConf(AlluxioConfigurationSet conf)
Writes the configuration for the current node.
|
public static final org.slf4j.Logger LOG
public static final String UPLOAD_SUBDIR
public AgentProcessContext(AlluxioConfiguration conf) throws Exception
AgentProcessContext
.conf
- the Alluxio ConfigurationException
- if the context fails to initializepublic AgentProcessContext(AlluxioConfiguration conf, RpcClient<ManagerAgentServiceGrpc.ManagerAgentServiceBlockingStub> client) throws Exception
AgentProcessContext
.conf
- the Alluxio Configurationclient
- the RPC client to useException
- if the context fails to initializepublic void close()
close
in interface AutoCloseable
public Set<AlluxioNodeType> alluxioProcesses()
protected HubNodeAddress getNodeAddress()
public void changeState(AlluxioNodeType type, ProcessStateChange action) throws IOException, TimeoutException, InterruptedException
ProcessStateChange.RESTART
will result in the same state but guarantee
that the desired process was stopped and then started.type
- the process to perform the action onaction
- the action to perform on the processIOException
- if there is a failure to obtain the current state of the processTimeoutException
- if a process fails to start in a timely mannerInterruptedException
- if the thread handling is interrupted during a start or stoppublic AlluxioConfigurationSet getConf() throws IOException
AlluxioConfigurationSet
representing the node's configuration on diskIOException
- if there are any failures reading the configurationpublic void writeConf(AlluxioConfigurationSet conf) throws IOException
conf
- the configuration to write to diskIOException
- if there are any failures writing to diskpublic String getPropertyFromFile(PropertyKey key)
key
- property keypublic boolean updateConf(Properties props)
props
- properties to be updatedpublic boolean uploadFile(String filePath, String permission, com.google.protobuf.ByteString fileContent, UploadProcessType uploadType)
filePath
- file pathpermission
- permission string such as 0777fileContent
- file contentuploadType
- upload destination typepublic boolean removeFile(String fileName, UploadProcessType uploadProcessType)
fileName
- the name of the fileuploadProcessType
- upload typepublic List<AgentListFileInfo> listFile()
public void restartPresto() throws IOException
IOException
upon failure.IOException
Copyright © 2023. All Rights Reserved.