-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add entrance for pagerank and wcc #1114
Conversation
Change-Id: I9d0a35ac8ea2cd7f1c9b6cf86a62a06e68d6498d
Codecov Report
@@ Coverage Diff @@
## master #1114 +/- ##
============================================
- Coverage 69.38% 66.13% -3.26%
- Complexity 5625 5652 +27
============================================
Files 331 354 +23
Lines 27126 28686 +1560
Branches 3898 4044 +146
============================================
+ Hits 18821 18971 +150
- Misses 6454 7847 +1393
- Partials 1851 1868 +17
Continue to review full report at Codecov.
|
this.userDefinedParameters.put(PRECISION, threshold(parameters)); | ||
} | ||
|
||
private static double threshold (Map<String, Object> parameters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space in "threshold ("
return value; | ||
} | ||
|
||
public static String parameterString(Map<String, Object> parameters, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add ParameterUtil class and move these methods to it
} | ||
|
||
private Map<String, Object> readCommonConfig() { | ||
return readSubConfig(COMMON); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.readSubConfig
ComputePool pool = ComputePool.instance(); | ||
Compute compute = pool.find(name); | ||
E.checkArgument(compute != null, | ||
"There is no compute named '%s'", name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no compute method named
builder.name("compute:" + compute) | ||
.input(JsonUtil.toJson(input)) | ||
.job(new ComputeJob()); | ||
return ImmutableMap.of("task_id", builder.schedule().id()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define var for builder.schedule()
|
||
public static final ConfigOption<String> COMPUTER_CONFIG = | ||
new ConfigOption<>( | ||
"computer.config", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compute/computer unify into one
public static final String COMPUTE = "compute"; | ||
|
||
public static boolean check(String name, Map<String, Object> parameters) { | ||
Compute algorithm = ComputePool.instance().find(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename
@@ -212,6 +212,10 @@ public static HugeServerInfo fromVertex(Vertex vertex) { | |||
} | |||
|
|||
public <V> boolean suitableFor(HugeTask<V> task, long now) { | |||
if (task.compute() && !this.role.computer() || | |||
!task.compute() && this.role.computer()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use task.compute() != this.role.computer()
this.userDefinedParameters.put(PRECISION, threshold(parameters)); | ||
} | ||
|
||
private static double threshold(Map<String, Object> parameters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to precision
@SuppressWarnings("unchecked") | ||
private void setComputeSpecifiedParameters() { | ||
((Map<String, Object>) this.commonConfig.get(EXTRA_ARGS)) | ||
.putAll(this.userDefinedParameters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
align with "."
@Override | ||
public void checkParameters(Map<String, Object> parameters) { | ||
this.userDefinedParameters.put(MAX_STEPS, maxSteps(parameters)); | ||
this.userDefinedParameters.put(ALPHA, alpha(parameters)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add precision
Compute compute = pool.find(name); | ||
E.checkArgument(compute != null, | ||
"There is no compute method named '%s'", name); | ||
compute.checkParameters(parameters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move into call and rename checkParameters to checkAndCollectParameters
|
||
private YamlConfiguration config; | ||
private Map<String, Object> commonConfig = new HashMap<>(); | ||
protected Map<String, Object> userDefinedParameters = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't define as field
Change-Id: I6038bd61f5ca9a664acabb4f2036efbda912e62a
// Set current compute job's specified parameters | ||
this.setComputeSpecifiedParameters(); | ||
// Set current computer job's specified parameters | ||
this.commonConfig.putAll(this.checkAndCollectParameters(parameters)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't update commonConfig
|
||
// Construct shell command for compute job | ||
// Construct shell command for computer job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.constructShellCommands
import com.baidu.hugegraph.util.E; | ||
import com.baidu.hugegraph.util.JsonUtil; | ||
|
||
public class ComputeJob extends SysJob<Object> { | ||
public class ComputerJob extends SysJob<Object> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extends UserJob
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need get computer conf from SysJob's params
return true; | ||
} | ||
|
||
public HugeConfig config() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not expose HugeConfig to the outside
private static final String ARG_SYMBOL = "C"; | ||
private static final String MINUS = "-"; | ||
private static final String EQUAL = "="; | ||
private static final String EMPTY = " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SPACE
try { | ||
Process process = Runtime.getRuntime().exec(command); | ||
exitCode = process.waitFor(); | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache throwable
return DEFAULT_PRECISION; | ||
} | ||
double precision = ParameterUtil.parameterDouble(parameters, PRECISION); | ||
E.checkArgument(precision > 0 && precision < 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to 0.0 1.0
worker_heap: 10000, | ||
vertex_input_dir: /data/data_wdc_600/arc, | ||
workers: 51, | ||
zookeeper_list: "10.157.11.170:2181", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
127.0
Change-Id: I9d0a35ac8ea2cd7f1c9b6cf86a62a06e68d6498d