-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE-409] support submit job to ray cluster (#439)
- Loading branch information
Showing
35 changed files
with
184 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 0 additions & 157 deletions
157
...-on-ray-community/src/main/java/com/antgroup/geaflow/cluster/ray/utils/RaySystemFunc.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...oy/geaflow-on-ray/src/main/java/com/antgroup/geaflow/cluster/ray/utils/RaySystemFunc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright 2023 AntGroup CO., Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
*/ | ||
|
||
package com.antgroup.geaflow.cluster.ray.utils; | ||
|
||
import static com.antgroup.geaflow.common.config.keys.ExecutionConfigKeys.JOB_WORK_PATH; | ||
|
||
import com.antgroup.geaflow.cluster.config.ClusterConfig; | ||
import com.antgroup.geaflow.cluster.ray.config.RayConfig; | ||
import com.antgroup.geaflow.common.config.Configuration; | ||
import io.ray.api.Ray; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.Serializable; | ||
import org.apache.commons.io.FileUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class RaySystemFunc implements Serializable { | ||
|
||
private static final long serialVersionUID = -3708025618479190982L; | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(RaySystemFunc.class); | ||
|
||
private static final Object LOCK = new Object(); | ||
private static String appPath; | ||
|
||
public static boolean isRestarted() { | ||
return Ray.getRuntimeContext().wasCurrentActorRestarted(); | ||
} | ||
|
||
public static boolean isLocalMode() { | ||
return Ray.getRuntimeContext().isLocalMode(); | ||
} | ||
|
||
public static String getWorkPath() { | ||
if (appPath != null) { | ||
return appPath; | ||
} | ||
synchronized (LOCK) { | ||
if (Ray.getRuntimeContext().isLocalMode()) { | ||
appPath = "/tmp/" + System.currentTimeMillis(); | ||
try { | ||
FileUtils.forceMkdir(new File(appPath)); | ||
} catch (IOException e) { | ||
LOGGER.error(e.getMessage(), e); | ||
} | ||
} else { | ||
appPath = Ray.getRuntimeContext().getCurrentRuntimeEnv() | ||
.get(RayConfig.RAY_JOB_WORKING_DIR, String.class); | ||
} | ||
} | ||
return appPath; | ||
} | ||
|
||
public static void initRayEnv(ClusterConfig clusterConfig) { | ||
LOGGER.info("clusterConfig:{}", clusterConfig); | ||
Configuration config = clusterConfig.getConfig(); | ||
|
||
// Set working dir. | ||
System.setProperty( | ||
String.format("%s.%s", RayConfig.RAY_JOB_RUNTIME_ENV, RayConfig.RAY_JOB_WORKING_DIR), | ||
config.getString(JOB_WORK_PATH)); | ||
Ray.init(); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.