Changeset 4311
- Timestamp:
- May 23, 2008, 2:24:56 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/src/docbook/admindoc/user_administration.xml
r3944 r4311 848 848 </listitem> 849 849 </varlistentry> 850 851 <varlistentry> 852 <term> 853 <guilabel>Select job agent for jobs</guilabel> 854 </term> 855 <listitem> 856 <para> 857 Allows the user to select a specific job agent when running jobs. 858 Users without this permission will always have a randomly selected 859 job agent. 860 </para> 861 </listitem> 862 </varlistentry> 863 850 864 <varlistentry> 851 865 <term> -
trunk/doc/src/docbook/userdoc/jobs.xml
r4309 r4311 245 245 <varlistentry> 246 246 <term> 247 <guilabel>Job agent</guilabel> 248 </term> 249 <listitem> 250 <para> 251 The job agent the job is/was running on. It is also 252 possible to set this value before a job is executed. If that 253 has been done only the selected job agent will accept the job. 254 This options is normally only given to powers users and 255 needs the <emphasis>Select job agent</emphasis> permission. 256 See <xref linkend="user_administration.roles.edit" />. 257 </para> 258 </listitem> 259 </varlistentry> 260 <varlistentry> 261 <term> 247 262 <guilabel>User/Owner</guilabel> 248 263 </term> -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/JobRunner.java
r3857 r4311 108 108 109 109 // Change the status to Job.Status.PREPARED 110 j.setPrepared(agent.getServerName() );110 j.setPrepared(agent.getServerName(), agent.getJobAgent(dc)); 111 111 try 112 112 { -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/DummyJobExecutor.java
r4093 r4311 99 99 dc = sc.newDbControl(); 100 100 job = Job.getById(dc, job.getId()); 101 job.start("Not really, but used for testing the job agent", agent.getServerName()); 101 job.start("Not really, but used for testing the job agent", 102 agent.getServerName(), agent.getJobAgent(dc)); 102 103 if (wait > 0) 103 104 { -
trunk/src/core/common-queries.xml
r4299 r4311 1424 1424 <description> 1425 1425 A Hibernate query that loads plugin jobs in the job queue waiting to be 1426 executed sorted by priority and waiting type. 1426 executed sorted by priority and waiting type. The query should return all 1427 jobs, ignoring all settings specifying that the internal job queue should 1428 not be used. 1427 1429 </description> 1428 1430 </query> … … 1435 1437 AND job.type = :type 1436 1438 AND job.pluginDefinition.useInternalJobQueue = true 1439 AND job.jobAgentId IS NULL 1437 1440 ORDER BY job.priority ASC, job.created ASC 1438 1441 </sql> … … 1440 1443 A Hibernate query that loads plugin jobs in the job queue waiting to be 1441 1444 executed sorted by priority and waiting type. It should only return 1442 jobs where the plug-in setting useInternalJobQueue=true 1445 jobs where the plug-in setting useInternalJobQueue=true and no 1446 specific job agent has been selected for the job. 1443 1447 </description> 1444 1448 </query> -
trunk/src/core/net/sf/basedb/core/Install.java
r4299 r4311 107 107 method. 108 108 */ 109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(5 6).intValue();109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(57).intValue(); 110 110 111 111 public static synchronized void createTables(boolean update, final ProgressReporter progress) … … 302 302 303 303 HashMap<RoleData, Integer> systemPermissions = new HashMap<RoleData, Integer>(); 304 systemPermissions.put(roleAdmin, Permission.grant(Permission.SHARE_TO_EVERYONE ));305 systemPermissions.put(rolePower, Permission.grant(Permission.SHARE_TO_EVERYONE ));304 systemPermissions.put(roleAdmin, Permission.grant(Permission.SHARE_TO_EVERYONE, Permission.SELECT_JOBAGENT)); 305 systemPermissions.put(rolePower, Permission.grant(Permission.SHARE_TO_EVERYONE, Permission.SELECT_JOBAGENT)); 306 306 307 307 // System permissions … … 392 392 agentPermissions.put(Item.JOBAGENT, PERMISSION_READ | PERMISSION_CREATE); 393 393 agentPermissions.put(Item.MESSAGE, PERMISSION_CREATE); 394 agentPermissions.put(Item.SYSTEM, Permission.grant(Permission.ACT_AS_ANOTHER_USER ));394 agentPermissions.put(Item.SYSTEM, Permission.grant(Permission.ACT_AS_ANOTHER_USER, Permission.SELECT_JOBAGENT)); 395 395 addRolePermissions(roleJobAgent, agentPermissions); 396 396 } … … 1799 1799 } 1800 1800 } 1801 1801 1802 1802 /** 1803 1803 Create an {@link ItemKey}. -
trunk/src/core/net/sf/basedb/core/InternalJobQueue.java
r4265 r4311 452 452 453 453 // Change the status to Job.Status.PREPARED 454 job.setPrepared(Application.getHostName() );454 job.setPrepared(Application.getHostName(), null); 455 455 try 456 456 { -
trunk/src/core/net/sf/basedb/core/Job.java
r4257 r4311 672 672 673 673 /** 674 Get the job agent this job should run on, is running on or 675 was running on. 676 @return A job agent or null if not known 677 @since 2.8 678 */ 679 public JobAgent getJobAgent() 680 { 681 Integer id = getData().getJobAgentId(); 682 JobAgent agent = null; 683 if (id != null) 684 { 685 try 686 { 687 agent = JobAgent.getById(getDbControl(), id); 688 } 689 catch (ItemNotFoundException ex) 690 {} 691 } 692 return agent; 693 } 694 695 /** 696 Set the job agent this job should run on. If the job is already 697 running or has ended, this call is ignored. 698 <p> 699 NOTE! This method doesn't check that the specified job agent 700 has actually been configured to run the plug-in used by this job. 701 Setting this parameter to an incorrect value may result in the 702 job never being executed. 703 704 @param agent The job agent, or null to let any job agent run 705 the job 706 @throws PermissionDeniedException If the logged in user doesn't 707 have write permission on this job, or use permission on the 708 job agent or is lacking the {@link Permission#SELECT_JOBAGENT} 709 permission 710 @since 2.8 711 */ 712 public void setJobAgent(JobAgent agent) 713 { 714 Job.Status status = getStatus(); 715 if (status != Job.Status.WAITING) return; 716 checkPermission(Permission.WRITE); 717 if (agent != null) 718 { 719 if (!getSessionControl().hasSystemPermission(Permission.SELECT_JOBAGENT)) 720 { 721 throw new PermissionDeniedException(Permission.SELECT_JOBAGENT); 722 } 723 agent.checkPermission(Permission.USE); 724 } 725 getData().setJobAgentId(agent == null ? null : agent.getId()); 726 } 727 728 /** 674 729 Set information needed to create a signal transporter object that can be used 675 730 to send signals to the plug-in that is currently executing this job. … … 759 814 760 815 /** 816 @deprecated Use {@link #setPrepared(String, JobAgent)} instead 817 */ 818 public void setPrepared(String server) 819 throws PermissionDeniedException 820 { 821 setPrepared(server, null); 822 } 823 824 /** 761 825 Set the job's status to {@link Status#PREPARED}. This status is 762 used to signal that a job is about to be executed, but the actual exce ption826 used to signal that a job is about to be executed, but the actual excecution 763 827 hasn't started yet. This status prevents two job agents from trying to 764 828 start the same job twice. 765 @param server Name of the server which this job will executed on. 829 830 @param server Name of the server which this job will executed on 831 @param agent The job agent that is going to execute the 832 job or null if it is executed by something else, eg. the 833 internal job queue 766 834 @throws PermissionDeniedException If the logged in user doesn't have write permission. 767 */ 768 public void setPrepared(String server) 835 @since 2.8 836 */ 837 public void setPrepared(String server, JobAgent agent) 769 838 throws PermissionDeniedException 770 839 { … … 778 847 data.setStatus(Status.PREPARED.getValue()); 779 848 data.setServer(StringUtil.setNullableString(server, "server", MAX_SERVER_LENGTH)); 780 } 781 782 /** 783 Register the job as started. Note! This method doesn't start the actual 849 getData().setJobAgentId(agent == null ? null : agent.getId()); 850 } 851 852 /** 853 @deprecated Use {@link #start(String, String, JobAgent)} instead 854 */ 855 public void start(String statusMessage, String server) 856 throws PermissionDeniedException, InvalidDataException 857 { 858 start(statusMessage, server, null); 859 } 860 861 /** 862 Register the job as started. Note! This method doesn't start the actual 784 863 execution of the job. This method should be called by an job runner application 785 864 to tell the core that the job runner has started to execute the job. … … 788 867 @param statusMessage A message 789 868 @param server The name of the server where the job is started 869 @param agent The job agent that is going to execute the 870 job or null if it is executed by something else, eg. the 871 internal job queue 790 872 @throws PermissionDeniedException If the logged in user doesn't have 791 873 write permission 792 874 @throws InvalidDataException If the status message is too long 793 */ 794 public void start(String statusMessage, String server) 875 @since 2.8 876 */ 877 public void start(String statusMessage, String server, JobAgent agent) 795 878 throws PermissionDeniedException, InvalidDataException 796 879 { … … 802 885 data.setStarted(new Date()); 803 886 data.setPercentComplete(0); 804 } 805 887 data.setJobAgentId(agent == null ? null : agent.getId()); 888 } 889 806 890 /** 807 891 Get a progress reporter that reports progress by updating the information … … 815 899 public ProgressReporter getProgressReporter(ProgressReporter chained) 816 900 { 817 return new ProgressReporterImpl(this, null, chained);901 return new ProgressReporterImpl(this, null, null, chained); 818 902 } 819 903 … … 941 1025 data.setStackTrace(null); 942 1026 data.setServer(null); 1027 data.setJobAgentId(null); 943 1028 if (useLatestConfiguration) 944 1029 { … … 992 1077 this, parameters, context, pd, pd.getAllowImmediateExecution() 993 1078 ); 994 request.setProgressReporter(new ProgressReporterImpl(this, null, null ));1079 request.setProgressReporter(new ProgressReporterImpl(this, null, null, null)); 995 1080 return request; 996 1081 } … … 1052 1137 PluginConfiguration config = getPluginConfiguration(); 1053 1138 Plugin plugin = pd.newInstance(settings == null ? null : settings.getJarPath()); 1139 JobAgent agent = settings == null ? null : settings.getJobAgent(); 1054 1140 SessionControl sc = getSessionControl(); 1055 1141 ParameterValuesImpl parameters = new ParameterValuesImpl(this, true); 1056 ProgressReporterImpl jobProgress = new ProgressReporterImpl(this, server, progress); 1142 ProgressReporterImpl jobProgress = 1143 new ProgressReporterImpl(this, server, agent, progress); 1057 1144 1058 1145 PluginExecutionRequest request = … … 1373 1460 private final String server; 1374 1461 private final Job job; 1462 private final JobAgent agent; 1375 1463 private final ProgressReporter chained; 1376 1464 private long lastUpdate; … … 1379 1467 private int offset; 1380 1468 1381 ProgressReporterImpl(Job job, String server, ProgressReporter chained)1469 ProgressReporterImpl(Job job, String server, JobAgent agent, ProgressReporter chained) 1382 1470 throws BaseException 1383 1471 { … … 1386 1474 this.jobId = job.getId(); 1387 1475 this.server = server; 1476 this.agent = agent; 1388 1477 this.chained = chained; 1389 1478 this.lastUpdate = 0; … … 1501 1590 job.setSignalTransporter(signalTransporter, signalId); 1502 1591 } 1503 job.start("Starting...", server );1592 job.start("Starting...", server, agent); 1504 1593 dc.commit(); 1505 1594 } -
trunk/src/core/net/sf/basedb/core/JobAgent.java
r4034 r4311 391 391 AND (job.owner IN (:sharedToUsers) OR job.activeProjectId IN (:sharedToProjects) 392 392 AND job.status = Job.Status.WAITING 393 AND job.jobAgentId IS NULL OR job.jobAgentId = this.id 393 394 ORDER BY job.priority - jas.priorityBoost ASC, job.created ASC 394 395 */ … … 483 484 Hql.property("status"), 484 485 Expressions.integer(Job.Status.WAITING.getValue()) 486 ) 487 ); 488 489 // Filter out jobs that have been marked for other job agents 490 // jobAgentId = this.id OR jobAgentId IS NULL 491 query.restrictPermanent( 492 Restrictions.or( 493 Restrictions.eq( 494 Hql.property("jobAgentId"), 495 Expressions.integer(getId()) 496 ), 497 Restrictions.eq(Hql.property("jobAgentId"), null) 485 498 ) 486 499 ); -
trunk/src/core/net/sf/basedb/core/Permission.java
r3679 r4311 126 126 item. 127 127 */ 128 ACT_AS_ANOTHER_USER(1024, 1024, "act as another user"); 128 ACT_AS_ANOTHER_USER(1024, 1024, "act as another user"), 129 130 /** 131 This permission allows a user to specify which job agent 132 a job should be executed on using {@link Job#setJobAgent(JobAgent)}. 133 This is a system permission and is only meaningful for the role key 134 for the {@link Item#SYSTEM} item. 135 @since 2.8 136 */ 137 SELECT_JOBAGENT(2048, 2048, "select job agent"); 129 138 130 139 private final int grantValue; … … 299 308 } 300 309 310 /** 311 Merges a list of integer permission values. 312 @param permissions The permission values, null values are ignored 313 @return The combined permissions 314 @since 2.8 315 */ 316 static int merge(Integer... permissions) 317 { 318 int perm = 0; 319 for (Integer i : permissions) 320 { 321 if (i != null) perm |= i; 322 } 323 return perm; 324 } 325 301 326 } 302 327 -
trunk/src/core/net/sf/basedb/core/PluginResponse.java
r4040 r4311 126 126 throw new PermissionDeniedException("Can't execute immediately since response status is: " + getStatus()); 127 127 } 128 ProgressReporterImpl jobProgress = new ProgressReporterImpl(request.getJob(), Application.getHostName(), progress);128 ProgressReporterImpl jobProgress = new ProgressReporterImpl(request.getJob(), Application.getHostName(), null, progress); 129 129 PluginExecutionRequest executionRequest = new PluginExecutionRequest(request, Request.COMMAND_EXECUTE); 130 130 executionRequest.setProgressReporter(jobProgress); -
trunk/src/core/net/sf/basedb/core/Update.java
r4299 r4311 53 53 import net.sf.basedb.core.data.ProjectData; 54 54 import net.sf.basedb.core.data.RawBioAssayData; 55 import net.sf.basedb.core.data.RoleData; 56 import net.sf.basedb.core.data.RoleKeyData; 55 57 import net.sf.basedb.core.data.SchemaVersionData; 56 58 import net.sf.basedb.core.data.TransformationData; … … 642 644 The update needs to calculate the number of reporters in existing 643 645 lists. 646 </td> 647 </tr> 648 649 <tr> 650 <td>57</td> 651 <td> 652 <ul> 653 <li>Added {@link net.sf.basedb.core.data.JobData#getJobAgentId()}. 654 </ul> 655 The update grants {@link Permission#SELECT_JOBAGENT} to the 656 administrators, power users and job agent roles. 644 657 </td> 645 658 </tr> … … 906 919 if (progress != null) progress.display((int)(55*progress_factor), "--Updating schema version: " + schemaVersion + " -> 56..."); 907 920 schemaVersion = updateToSchemaVersion56(session); 921 } 922 923 if (schemaVersion < 57) 924 { 925 if (progress != null) progress.display((int)(56*progress_factor), "--Updating schema version: " + schemaVersion + " -> 57..."); 926 schemaVersion = updateToSchemaVersion57(session); 908 927 } 909 928 … … 2232 2251 return schemaVersion; 2233 2252 } 2253 2254 /** 2255 Grant {@link Permission#SELECT_JOBAGENT} permission to 2256 administrators, power users and job agent roles. 2257 2258 @return The new schema version (=57) 2259 */ 2260 private static int updateToSchemaVersion57(org.hibernate.Session session) 2261 throws BaseException 2262 { 2263 final int schemaVersion = 57; 2264 org.hibernate.Transaction tx = null; 2265 try 2266 { 2267 tx = HibernateUtil.newTransaction(session); 2268 2269 int selectPermission = Permission.SELECT_JOBAGENT.grantValue(); 2270 2271 RoleData admin = HibernateUtil.loadData(session, RoleData.class, SystemItems.getId(Role.ADMINISTRATOR)); 2272 RoleData power = HibernateUtil.loadData(session, RoleData.class, SystemItems.getId(Role.POWER_USER)); 2273 RoleData agent = HibernateUtil.loadData(session, RoleData.class, SystemItems.getId(Role.JOBAGENT)); 2274 RoleKeyData systemKey = HibernateUtil.loadData(session, RoleKeyData.class, 2275 SystemItems.getRoleKeyId(Item.SYSTEM)); 2276 2277 Map<RoleData, Integer> rolePermissions = systemKey.getRoles(); 2278 rolePermissions.put(admin, Permission.merge(selectPermission, rolePermissions.get(admin))); 2279 rolePermissions.put(power, Permission.merge(selectPermission, rolePermissions.get(power))); 2280 rolePermissions.put(agent, Permission.merge(selectPermission, rolePermissions.get(agent))); 2281 2282 // Update the schema version number 2283 setSchemaVersion(session, schemaVersion); 2284 2285 // Commit the changes 2286 HibernateUtil.commit(tx); 2287 log.info("updateToSchemaVersion57: OK"); 2288 } 2289 catch (BaseException ex) 2290 { 2291 if (tx != null) HibernateUtil.rollback(tx); 2292 log.error("updateToSchemaVersion57: FAILED", ex); 2293 throw ex; 2294 } 2295 return schemaVersion; 2296 } 2297 2234 2298 /** 2235 2299 Adjust the existing items in the database to be compatible with the latest mappings. -
trunk/src/core/net/sf/basedb/core/data/JobData.java
r4074 r4311 378 378 } 379 379 380 private Integer jobAgentId; 381 /** 382 The ID of the job agent this job should run/is running/was running on. 383 We store this as an ID value only and not a reference to {@link JobAgentData} 384 since it would then be impossible to delete a job agent without also deleting 385 all jobs that has been running on it. 386 @since 2.8 387 @hibernate.property column="`jobagent_id`" type="int" not-null="false" 388 */ 389 public Integer getJobAgentId() 390 { 391 return jobAgentId; 392 } 393 public void setJobAgentId(Integer jobAgentId) 394 { 395 this.jobAgentId = jobAgentId; 396 } 397 380 398 private Map<String, ParameterValueData<?>> parameters; 381 399 /** -
trunk/www/admin/roles/edit_role.jsp
r3890 r4311 137 137 final boolean hasShareToEveryone = role == null ? false : system.getPermissions(role).contains(Permission.SHARE_TO_EVERYONE); 138 138 final boolean hasActAsAnotherUser = role == null ? false : system.getPermissions(role).contains(Permission.ACT_AS_ANOTHER_USER); 139 final boolean hasSelectJobagent = role == null ? false : system.getPermissions(role).contains(Permission.SELECT_JOBAGENT); 139 140 140 141 // Query to retrieve role keys … … 187 188 if (frm.share_to_everyone.checked) systemPermission += <%=PermissionUtil.getPermissionCode(EnumSet.of(Permission.SHARE_TO_EVERYONE))%>; 188 189 if (frm.act_as_another_user.checked) systemPermission += <%=PermissionUtil.getPermissionCode(EnumSet.of(Permission.ACT_AS_ANOTHER_USER))%>; 190 if (frm.select_jobagent.checked) systemPermission += <%=PermissionUtil.getPermissionCode(EnumSet.of(Permission.SELECT_JOBAGENT))%>; 189 191 frm['<%=Item.SYSTEM.name()%>'].value = systemPermission; 190 192 frm.submit(); … … 366 368 <input type="checkbox" value="1" name="act_as_another_user" 367 369 <%=hasActAsAnotherUser ? "checked" : ""%> 368 >Act as another user 370 >Act as another user<br> 371 <input type="checkbox" value="1" name="select_jobagent" 372 <%=hasSelectJobagent ? "checked" : ""%> 373 >Select job agent for jobs<br> 369 374 </td> 370 375 </tr> -
trunk/www/admin/roles/view_role.jsp
r4003 r4311 92 92 final boolean hasShareToEveryone = system.getPermissions(role).contains(Permission.SHARE_TO_EVERYONE); 93 93 final boolean hasActAsAnotherUser = system.getPermissions(role).contains(Permission.ACT_AS_ANOTHER_USER); 94 final boolean hasSelectJobagent = system.getPermissions(role).contains(Permission.SELECT_JOBAGENT); 94 95 95 96 final boolean writePermission = role.hasPermission(Permission.WRITE); … … 252 253 <td class="prompt">Share to everyone</td> 253 254 <td><%=hasShareToEveryone ? "yes" : "no"%></td> 255 <td class="prompt">Select job agent</td> 256 <td><%=hasSelectJobagent ? "yes" : "no"%></td> 254 257 </tr> 255 258 <tr> -
trunk/www/common/plugin/finish_job.jsp
r3675 r4311 36 36 import="net.sf.basedb.core.ItemResultList" 37 37 import="net.sf.basedb.core.Include" 38 import="net.sf.basedb.core.Permission" 38 39 import="net.sf.basedb.core.Job" 40 import="net.sf.basedb.core.JobAgent" 41 import="net.sf.basedb.core.PluginResponse" 39 42 import="net.sf.basedb.core.query.Hql" 40 43 import="net.sf.basedb.core.query.Expressions" … … 43 46 import="net.sf.basedb.core.plugin.GuiContext" 44 47 import="net.sf.basedb.core.plugin.Plugin" 48 import="net.sf.basedb.core.plugin.Response" 45 49 import="net.sf.basedb.core.plugin.InteractivePlugin" 46 50 import="net.sf.basedb.core.plugin.AutoDetectingImporter" … … 63 67 Job job = (Job)sc.getSessionSetting("plugin.configure.job"); 64 68 dc.reattachItem(job); 65 PluginDefinition plugin = job.getPluginDefinition(); //(PluginDefinition)sc.getSessionSetting("plugin.configure.plugin");66 PluginConfiguration pluginConfig = job.getPluginConfiguration(); // (PluginConfiguration)sc.getSessionSetting("plugin.configure.config");69 PluginDefinition plugin = job.getPluginDefinition(); 70 PluginConfiguration pluginConfig = job.getPluginConfiguration(); 67 71 boolean sendMessage = Values.getBoolean(sc.getUserClientSetting("plugins.sendmessage"), true); 68 72 boolean removeJobWhenFinished = Values.getBoolean(sc.getUserClientSetting("plugins.removejob"), false); 73 74 PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response"); 75 boolean executeImmediately = 76 pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY; 77 78 List<JobAgent> agents = null; 79 if (!executeImmediately && sc.hasSystemPermission(Permission.SELECT_JOBAGENT)) 80 { 81 ItemQuery<JobAgent> agentQuery = JobAgent.getQuery(); 82 agentQuery.join(Hql.innerJoin("plugins", "plg")); 83 agentQuery.restrict(Restrictions.eq(Hql.index("plg", null), Hql.entity(plugin))); 84 agentQuery.include(Include.ALL); 85 agentQuery.order(Orders.asc(Hql.property("name"))); 86 agents = agentQuery.list(dc); 87 } 69 88 %> 70 89 <base:page type="popup" title="Set job name and options"> … … 112 131 </td> 113 132 </tr> 133 134 <% 135 if (agents != null && agents.size() > 0) 136 { 137 %> 138 <tr valign="top"> 139 <td class="prompt">Use job agent</td> 140 <td> 141 <select name="agent_id"> 142 <option value="">- automatic - 143 <% 144 for (JobAgent agent : agents) 145 { 146 %> 147 <option value="<%=agent.getId()%>"><%=HTML.encodeTags(agent.getName())%> 148 <% 149 } 150 %> 151 </select> 152 </td> 153 </tr> 154 <% 155 } 156 %> 157 114 158 <tr valign="top"> 115 159 <td class="prompt">Job description</td> -
trunk/www/common/plugin/index.jsp
r4265 r4311 51 51 import="net.sf.basedb.core.Path" 52 52 import="net.sf.basedb.core.Job" 53 import="net.sf.basedb.core.JobAgent" 53 54 import="net.sf.basedb.core.Type" 54 55 import="net.sf.basedb.core.Experiment" … … 517 518 Job job = (Job)sc.getSessionSetting("plugin.configure.job"); 518 519 PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response"); 520 boolean executeImmediately = 521 pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY; 519 522 520 523 job.setName(Values.getStringOrNull(request.getParameter("name"))); … … 523 526 job.setRemoveJobWhenFinished(Values.getBoolean(request.getParameter("remove_job"))); 524 527 dc.saveItem(job); 528 529 if (!executeImmediately) 530 { 531 int agentId = Values.getInt(request.getParameter("agent_id"), -1); 532 if (agentId >= 0) 533 { 534 job.setJobAgent(agentId == 0 ? null : JobAgent.getById(dc, agentId)); 535 } 536 } 537 525 538 if (pluginResponse != null) pluginResponse.saveParameters(dc); 526 539 dc.commit(); … … 532 545 sc.setSessionSetting("plugin.configure.config", null); 533 546 sc.setSessionSetting("plugin.configure.currentContext", null); 534 if ( pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY)547 if (executeImmediately) 535 548 { 536 549 PluginExecutionRequest executionRequest = pluginResponse.getExecutionRequest(null); -
trunk/www/include/scripts/main.js
r4302 r4311 398 398 this.controllers['BIOASSAYSET'] = { url:'views/experiments/bioassaysets/index.jsp', width:800, height:500 }; 399 399 this.controllers['TRANSFORMATION'] = { url:'views/experiments/transformations/index.jsp', width:500, height:300 }; 400 this.controllers['JOB'] = { url:'views/jobs/index.jsp', width:6 00, height:440, popup:true, edit:false };400 this.controllers['JOB'] = { url:'views/jobs/index.jsp', width:640, height:480, popup:true, edit:false }; 401 401 this.controllers['FORMULA'] = { url:'views/formulas/index.jsp', width:740, height:500 }; 402 402 this.controllers['HYBRIDIZATION'] = { url:'views/hybridizations/index.jsp', width:800, height:500 }; -
trunk/www/views/jobs/list_jobs.jsp
r4003 r4311 31 31 import="net.sf.basedb.core.Item" 32 32 import="net.sf.basedb.core.Job" 33 import="net.sf.basedb.core.JobAgent" 33 34 import="net.sf.basedb.core.ItemQuery" 34 35 import="net.sf.basedb.core.Include" … … 40 41 import="net.sf.basedb.core.PermissionDeniedException" 41 42 import="net.sf.basedb.core.query.Hql" 43 import="net.sf.basedb.core.query.Orders" 42 44 import="net.sf.basedb.core.query.Restrictions" 43 45 import="net.sf.basedb.core.query.Expressions" … … 94 96 try 95 97 { 98 99 // Get all job agents 100 final ItemQuery<JobAgent> agentQuery = JobAgent.getQuery(); 101 agentQuery.include(Include.ALL); 102 agentQuery.order(Orders.asc(Hql.property("name"))); 103 agentQuery.setCacheResult(true); 104 Enumeration<String, String> agents = new Enumeration<String, String>(); 105 for (JobAgent a : agentQuery.list(dc)) 106 { 107 agents.add(Integer.toString(a.getId()), a.getName()); 108 } 109 96 110 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); 97 111 try … … 277 291 filterable="true" 278 292 exportable="true" 293 /> 294 <tbl:columndef 295 id="jobagent" 296 property="jobAgentId" 297 datatype="int" 298 title="Job agent" 299 filterable="true" 300 enumeration="<%=agents%>" 279 301 /> 280 302 <tbl:columndef … … 497 519 readPlugin = false; 498 520 } 521 JobAgent agent = null; 522 boolean readAgent = true; 523 try 524 { 525 agent = item.getJobAgent(); 526 } 527 catch (PermissionDeniedException ex) 528 { 529 readAgent = false; 530 } 499 531 %> 500 532 <tbl:row> … … 545 577 <tbl:cell column="stackTrace"><%=HTML.encodeTags(item.getStackTrace())%></tbl:cell> 546 578 <tbl:cell column="server"><%=HTML.encodeTags(item.getServer())%></tbl:cell> 579 <tbl:cell column="jobagent"><%=Base.getLinkedName(ID, agent, !readAgent, true)%></tbl:cell> 547 580 <tbl:cell column="estimatedExecutionTime"><%=item.getEstimatedExecutionTime()%></tbl:cell> 548 581 <tbl:cell column="percentComplete"> -
trunk/www/views/jobs/view_job.jsp
r4127 r4311 35 35 import="net.sf.basedb.core.Permission" 36 36 import="net.sf.basedb.core.Job" 37 import="net.sf.basedb.core.JobAgent" 37 38 import="net.sf.basedb.core.BasicItem" 38 39 import="net.sf.basedb.core.Nameable" … … 97 98 readCurrentConfig = false; 98 99 } 100 boolean readAgent = true; 101 JobAgent agent = null; 102 try 103 { 104 agent = job.getJobAgent(); 105 } 106 catch (PermissionDeniedException ex) 107 { 108 readAgent = false; 109 } 99 110 100 111 int parameterVersion = job.getParameterVersion(); … … 174 185 <base:body onload="autoUpdate()"> 175 186 <h3 class="docked"><%=title%> <base:help tabcontrol="main" /></h3> 176 <t:tabcontrol id="main" active="<%=tab%>" position="bottom" contentstyle="<%="height: "+(int)(scale*3 20)+"px;"%>">187 <t:tabcontrol id="main" active="<%=tab%>" position="bottom" contentstyle="<%="height: "+(int)(scale*350)+"px;"%>"> 177 188 <t:tab id="properties" title="Properties" helpid="job.view.properties"> 178 189 … … 287 298 <%=HTML.encodeTags(job.getServer())%> 288 299 </td> 300 </tr> 301 <tr valign="top"> 302 <td class="prompt">Job agent</td> 303 <td><%=Base.getEncodedName(agent, !readAgent)%></td> 289 304 </tr> 290 305 <tr valign="top">
Note: See TracChangeset
for help on using the changeset viewer.